Showing
11 changed files
with
85 additions
and
42 deletions
@@ -45,6 +45,7 @@ dropDown.prototype={ | @@ -45,6 +45,7 @@ dropDown.prototype={ | ||
45 | }, | 45 | }, |
46 | processResults: function (data, params) { | 46 | processResults: function (data, params) { |
47 | params.page = params.page || 1; | 47 | params.page = params.page || 1; |
48 | + data.data.data.unshift({id:'-1',text:"请选择"}); | ||
48 | return { | 49 | return { |
49 | results: data.data.data | 50 | results: data.data.data |
50 | } | 51 | } |
@@ -127,7 +127,8 @@ edit.prototype={ | @@ -127,7 +127,8 @@ edit.prototype={ | ||
127 | if($('input[type="file"]').length>0){ | 127 | if($('input[type="file"]').length>0){ |
128 | $('input[type="file"]').each(function(){ | 128 | $('input[type="file"]').each(function(){ |
129 | var src=$(this).attr("value"); | 129 | var src=$(this).attr("value"); |
130 | - var Temp='<ul class="upload-image-list">'; | 130 | + var _id=$(this).attr("id")||$(this).attr("name"); |
131 | + var Temp='<ul class="upload-image-list" id="img-'+_id+'">'; | ||
131 | Temp+='<li class="fileinput-button">'; | 132 | Temp+='<li class="fileinput-button">'; |
132 | Temp+='<a class="fileinput-button-icon" href="javascript:void(0);">'; | 133 | Temp+='<a class="fileinput-button-icon" href="javascript:void(0);">'; |
133 | if(src){ | 134 | if(src){ |
@@ -156,7 +157,9 @@ edit.prototype={ | @@ -156,7 +157,9 @@ edit.prototype={ | ||
156 | 'onStart': function() { | 157 | 'onStart': function() { |
157 | }, | 158 | }, |
158 | 'onCancel': function() { | 159 | 'onCancel': function() { |
159 | - console.log('no file selected'); | 160 | + // var _id=$(this).attr("id")||$(this).attr("name"); |
161 | + // $(".fileinput-button-icon","#img-"+_id).html("+"); | ||
162 | + // $(this).attr("value",""); | ||
160 | } | 163 | } |
161 | }); | 164 | }); |
162 | } | 165 | } |
@@ -165,7 +165,7 @@ grid.prototype={ | @@ -165,7 +165,7 @@ grid.prototype={ | ||
165 | if (column.name) c.attr({ columnname: column.name }); | 165 | if (column.name) c.attr({ columnname: column.name }); |
166 | var h_t = column.display || ""; | 166 | var h_t = column.display || ""; |
167 | c.html(h_t); | 167 | c.html(h_t); |
168 | - if(column.checkbox) c.html("<input type='checkbox' class='wqt_all' />"); | 168 | + if(column.type) c.html("<input type='"+column.type+"' class='wqt_all' />"); |
169 | return column.hidden?"":c; | 169 | return column.hidden?"":c; |
170 | }, | 170 | }, |
171 | ajax:function(param){ | 171 | ajax:function(param){ |
@@ -245,8 +245,8 @@ grid.prototype={ | @@ -245,8 +245,8 @@ grid.prototype={ | ||
245 | if (!row || !col) return ""; | 245 | if (!row || !col) return ""; |
246 | var value = col.name ? row[col.name] : null; | 246 | var value = col.name ? row[col.name] : null; |
247 | var content = ""; | 247 | var content = ""; |
248 | - if(col.checkbox){ | ||
249 | - content="<input type='checkbox' name='"+col.name+"' class='wqt_checkbox' data-index='"+row.__index+"'>"; | 248 | + if(col.type){ |
249 | + content="<input type='"+col.type+"' name='"+col.name+"' class='wqt_checkbox' data-index='"+row.__index+"'>"; | ||
250 | }else if (col.render) { | 250 | }else if (col.render) { |
251 | content = col.render.call(g, row, value, col); | 251 | content = col.render.call(g, row, value, col); |
252 | } else { | 252 | } else { |
@@ -265,12 +265,14 @@ grid.prototype={ | @@ -265,12 +265,14 @@ grid.prototype={ | ||
265 | $(g.grid).on("change",".wqt_all",function(){ | 265 | $(g.grid).on("change",".wqt_all",function(){ |
266 | var selected=$(".wqt_all").prop("checked"); | 266 | var selected=$(".wqt_all").prop("checked"); |
267 | $(".wqt_checkbox").prop("checked",selected); | 267 | $(".wqt_checkbox").prop("checked",selected); |
268 | - if(selected){ | ||
269 | - console.log(g.rows); | ||
270 | - g.selected=g.rows; | ||
271 | - }else{ | ||
272 | - g.selected.length=0; | ||
273 | - } | 268 | + g.selected.length=0; |
269 | + $(".wqt_checkbox").each(function(){ | ||
270 | + var checked=$(this).prop("checked"); | ||
271 | + var index=$(this).data("index"); | ||
272 | + if(checked){ | ||
273 | + g.selected.push(g.rows[index]); | ||
274 | + } | ||
275 | + }); | ||
274 | 276 | ||
275 | });//g.selected | 277 | });//g.selected |
276 | //$(".wqt_checkbox").prop("checked",true); | 278 | //$(".wqt_checkbox").prop("checked",true); |
@@ -33,13 +33,16 @@ var $ = require('jquery'), | @@ -33,13 +33,16 @@ var $ = require('jquery'), | ||
33 | }); | 33 | }); |
34 | }, | 34 | }, |
35 | selectManagerName:function(id,eqid){ | 35 | selectManagerName:function(id,eqid){ |
36 | + if(!~id){ | ||
37 | + return false; | ||
38 | + } | ||
36 | common.util.__ajax({ | 39 | common.util.__ajax({ |
37 | url:'/supplier/storeadmin/managerName', | 40 | url:'/supplier/storeadmin/managerName', |
38 | data:{ | 41 | data:{ |
39 | identity:id//$('#identity-type option:selected').val() | 42 | identity:id//$('#identity-type option:selected').val() |
40 | } | 43 | } |
41 | },function(res){ | 44 | },function(res){ |
42 | - $('#manager-name').html(''); | 45 | + $('#manager-name').html('<option value="">请选择管理员</option>'); |
43 | if(res.data&&res.data.length>0){ | 46 | if(res.data&&res.data.length>0){ |
44 | $.each(res.data,function(index,item){ | 47 | $.each(res.data,function(index,item){ |
45 | var $option=$("<option></option>"); | 48 | var $option=$("<option></option>"); |
@@ -50,7 +53,8 @@ var $ = require('jquery'), | @@ -50,7 +53,8 @@ var $ = require('jquery'), | ||
50 | $option.html(item.truename); | 53 | $option.html(item.truename); |
51 | $("#manager-name").append($option); | 54 | $("#manager-name").append($option); |
52 | }) | 55 | }) |
53 | - } | 56 | + }; |
57 | + new common.dropDown({el:"#manager-name"}); | ||
54 | 58 | ||
55 | },true); | 59 | },true); |
56 | }, | 60 | }, |
@@ -80,6 +84,7 @@ var $ = require('jquery'), | @@ -80,6 +84,7 @@ var $ = require('jquery'), | ||
80 | }); | 84 | }); |
81 | }); | 85 | }); |
82 | new common.dropDown({el:"#store-name",ajax:"shopsRest"}); | 86 | new common.dropDown({el:"#store-name",ajax:"shopsRest"}); |
87 | + new common.dropDown({el:"#manager-name"}); | ||
83 | // | 88 | // |
84 | $('#identity-type').on('change',function(){ | 89 | $('#identity-type').on('change',function(){ |
85 | Bll.selectManagerName($(this).val()); | 90 | Bll.selectManagerName($(this).val()); |
@@ -258,13 +258,14 @@ var Bll={ | @@ -258,13 +258,14 @@ var Bll={ | ||
258 | } | 258 | } |
259 | } | 259 | } |
260 | 260 | ||
261 | + | ||
261 | var g=new common.grid({ | 262 | var g=new common.grid({ |
262 | el:"#baseTable", | 263 | el:"#baseTable", |
263 | parms:function(){ | 264 | parms:function(){ |
264 | return {brandId: $('#brandname').val()} | 265 | return {brandId: $('#brandname').val()} |
265 | }, | 266 | }, |
266 | columns:[ | 267 | columns:[ |
267 | - {display:"选择","checkbox":true}, | 268 | + {display:"选择","type":"checkbox"}, |
268 | {display:"品牌",render:function(item){ | 269 | {display:"品牌",render:function(item){ |
269 | item.brandName=$.trim($("#brandname").text().replace(/选择品牌/g,'')); | 270 | item.brandName=$.trim($("#brandname").text().replace(/选择品牌/g,'')); |
270 | return item.brandName; | 271 | return item.brandName; |
@@ -305,7 +306,6 @@ e.on("render",function(){ | @@ -305,7 +306,6 @@ e.on("render",function(){ | ||
305 | }); | 306 | }); |
306 | 307 | ||
307 | (!!~$("#shopsType").val())?$("#modalId").prop("disabled",false):$("#modalId").prop("disabled",true); | 308 | (!!~$("#shopsType").val())?$("#modalId").prop("disabled",false):$("#modalId").prop("disabled",true); |
308 | - | ||
309 | //修改 | 309 | //修改 |
310 | if($("#shopRelationList").val()){ | 310 | if($("#shopRelationList").val()){ |
311 | var a=JSON.parse($("#shopRelationList").val()); | 311 | var a=JSON.parse($("#shopRelationList").val()); |
@@ -322,18 +322,39 @@ e.on("bind",function(){ | @@ -322,18 +322,39 @@ e.on("bind",function(){ | ||
322 | }); | 322 | }); |
323 | 323 | ||
324 | $("#shopsType").change(function(){ | 324 | $("#shopsType").change(function(){ |
325 | - (!!~$("#shopsType").val())?$("#modalId").prop("disabled",false):$("#modalId").prop("disabled",true); | 325 | + |
326 | + if(!!~$("#shopsType").val()){ | ||
327 | + $("#modalId").prop("disabled",false); | ||
328 | + }else{ | ||
329 | + $("#modalId").prop("disabled",true); | ||
330 | + | ||
331 | + } | ||
332 | + if(g2.grid){ | ||
333 | + g2.__rows.length=0; | ||
334 | + g2.reload(); | ||
335 | + } | ||
336 | + | ||
337 | + | ||
326 | }); | 338 | }); |
327 | 339 | ||
328 | $("#modalId").click(function(){ | 340 | $("#modalId").click(function(){ |
341 | + var __feild="brandId"; | ||
342 | + if((+$("#shopsType").val()==1)){ | ||
343 | + g.options.columns[0].type="radio"; | ||
344 | + __feild="brandId"; | ||
345 | + g2.__rows.length=0; | ||
346 | + }else{ | ||
347 | + g.options.columns[0].type="checkbox"; | ||
348 | + __feild="supplierId"; | ||
349 | + } | ||
329 | //common.util.__template($("#template").html(),{}) | 350 | //common.util.__template($("#template").html(),{}) |
330 | common.dialog.confirm("添加供应商关系",$("#template").html(),function(){ | 351 | common.dialog.confirm("添加供应商关系",$("#template").html(),function(){ |
331 | - console.log(g.selected); | 352 | + |
332 | $.each(g.selected,function(index,item){ | 353 | $.each(g.selected,function(index,item){ |
333 | //item.supplierId | 354 | //item.supplierId |
334 | var i=0; | 355 | var i=0; |
335 | $.each(g2.__rows,function(index1,item1){ | 356 | $.each(g2.__rows,function(index1,item1){ |
336 | - if(item1.brandId==item.brandId){ | 357 | + if(item1[__feild]==item[__feild]){ |
337 | i++; | 358 | i++; |
338 | } | 359 | } |
339 | }); | 360 | }); |
@@ -356,9 +377,7 @@ e.on("bind",function(){ | @@ -356,9 +377,7 @@ e.on("bind",function(){ | ||
356 | }); | 377 | }); |
357 | 378 | ||
358 | $("#updateBrand").on("click",".delete",function(){ | 379 | $("#updateBrand").on("click",".delete",function(){ |
359 | - console.log(g2.__rows); | ||
360 | g2.__rows.splice($(this).data("index"),1); | 380 | g2.__rows.splice($(this).data("index"),1); |
361 | - console.log(g2.__rows); | ||
362 | g2.reload(); | 381 | g2.reload(); |
363 | }); | 382 | }); |
364 | }); | 383 | }); |
@@ -410,10 +429,15 @@ e.on("validate",function(){ | @@ -410,10 +429,15 @@ e.on("validate",function(){ | ||
410 | }); | 429 | }); |
411 | 430 | ||
412 | e.on("validate",function(){ | 431 | e.on("validate",function(){ |
413 | - _arr.shopRelation=JSON.stringify(g2.rows); | ||
414 | - if(!_arr.shopRelation){ | 432 | + var i=0; |
433 | + for (var key in g2.rows) { | ||
434 | + i++; | ||
435 | + } | ||
436 | + if(!i){ | ||
415 | return "请选择关联品牌"; | 437 | return "请选择关联品牌"; |
416 | } | 438 | } |
439 | + _arr.shopRelation=JSON.stringify(g2.rows); | ||
440 | + | ||
417 | }); | 441 | }); |
418 | 442 | ||
419 | e.init(); | 443 | e.init(); |
@@ -69,11 +69,13 @@ var ENUM={// 审核状态;100 暂存 200 待审核 300 审核通过 900 驳 | @@ -69,11 +69,13 @@ var ENUM={// 审核状态;100 暂存 200 待审核 300 审核通过 900 驳 | ||
69 | if(+item.checkStatus!=200){ | 69 | if(+item.checkStatus!=200){ |
70 | HtmArr.push('<a href="/supplier/store/update/'+item.shopsId+'" href="javascript:void(0);" class="btn btn-success btn-xs">编辑</a>'); | 70 | HtmArr.push('<a href="/supplier/store/update/'+item.shopsId+'" href="javascript:void(0);" class="btn btn-success btn-xs">编辑</a>'); |
71 | } | 71 | } |
72 | - if(+item.status){ | ||
73 | - // 1开启 0 关闭 | ||
74 | - HtmArr.push('<a data-index="'+item.__index+'" href="javascript:void(0);" class="closeshops btn btn-success btn-xs">开店</a>'); | ||
75 | - }else{ | ||
76 | - HtmArr.push('<a data-index="'+item.__index+'" href="javascript:void(0);" class="openshops btn btn-danger btn-xs">关店</a>'); | 72 | + if(+item.checkStatus!=900){ |
73 | + if(+item.status){ | ||
74 | + // 1开启 0 关闭 | ||
75 | + HtmArr.push('<a data-index="'+item.__index+'" href="javascript:void(0);" class="openshops btn btn-success btn-xs">开店</a>'); | ||
76 | + }else{ | ||
77 | + HtmArr.push('<a data-index="'+item.__index+'" href="javascript:void(0);" class="closeshops btn btn-danger btn-xs">关店</a>'); | ||
78 | + } | ||
77 | } | 79 | } |
78 | } | 80 | } |
79 | return HtmArr.join(''); | 81 | return HtmArr.join(''); |
@@ -3,6 +3,12 @@ var edit=require('../common/edit'); | @@ -3,6 +3,12 @@ var edit=require('../common/edit'); | ||
3 | 3 | ||
4 | var e=new edit("#basicForm"); | 4 | var e=new edit("#basicForm"); |
5 | e.on("validate",function(){ | 5 | e.on("validate",function(){ |
6 | + //registeredCapital | ||
7 | + var registeredCapital=$.trim($("#registeredCapital").val()); | ||
8 | + //+registeredCapital<999999999.99 | ||
9 | + if(!/^(([0-9]{1,9})(\.[0-9]{1,2}){0,1})$/.test(registeredCapital)){ | ||
10 | + return "注册资本格式无效(0~999999999.99)"; | ||
11 | + } | ||
6 | 12 | ||
7 | var contactPhone=$.trim($("#contactPhone").val()); | 13 | var contactPhone=$.trim($("#contactPhone").val()); |
8 | if(contactPhone){ | 14 | if(contactPhone){ |
@@ -6,19 +6,19 @@ exports.uploadFile=function(req,res){ | @@ -6,19 +6,19 @@ exports.uploadFile=function(req,res){ | ||
6 | 6 | ||
7 | // TODO 代理上传 | 7 | // TODO 代理上传 |
8 | // 方法1 | 8 | // 方法1 |
9 | - if(req.is("multipart/form-data")){ | ||
10 | - req.body.file=fs.createReadStream(req.files[req.body.filename].path); | ||
11 | - request.post({url:domain+'/fileupload/upload',formData:req.body},function optionalCallback(err, httpResponse, body){ | ||
12 | - res.json(JSON.parse(body)); | ||
13 | - }); | ||
14 | - }else{ | ||
15 | - res.json({code:"500",message:"请求类型错误"}); | ||
16 | - } | ||
17 | - // res.json({ | ||
18 | - // "code":200, | ||
19 | - // "data" : "https://ss1.baidu.com/6ONXsjip0QIZ8tyhnq/it/u=1444256491,538988776&fm=80", | ||
20 | - // "message":"success" | 9 | + // if(req.is("multipart/form-data")){ |
10 | + // req.body.file=fs.createReadStream(req.files[req.body.filename].path); | ||
11 | + // request.post({url:domain+'/fileupload/upload',formData:req.body},function optionalCallback(err, httpResponse, body){ | ||
12 | + // res.json(JSON.parse(body)); | ||
21 | // }); | 13 | // }); |
14 | + // }else{ | ||
15 | + // res.json({code:"500",message:"请求类型错误"}); | ||
16 | + // } | ||
17 | + res.json({ | ||
18 | + "code":200, | ||
19 | + "data" : "https://ss1.baidu.com/6ONXsjip0QIZ8tyhnq/it/u=1444256491,538988776&fm=80", | ||
20 | + "message":"success" | ||
21 | + }); | ||
22 | 22 | ||
23 | //方法2 | 23 | //方法2 |
24 | // req.pipe(request.post(domain+'/fileupload/upload')) | 24 | // req.pipe(request.post(domain+'/fileupload/upload')) |
@@ -210,7 +210,7 @@ | @@ -210,7 +210,7 @@ | ||
210 | <div class="form-group"> | 210 | <div class="form-group"> |
211 | <label class="col-sm-2 control-label">调性指数</label> | 211 | <label class="col-sm-2 control-label">调性指数</label> |
212 | <div class="col-sm-2"> | 212 | <div class="col-sm-2"> |
213 | - <input type="text" id="brandTonality" name="brandTonality" class="form-control" pattern="^[0-100]$" placeholder="调性指数(范围:1-100)" value="{{brandTonality}}"> | 213 | + <input type="number" id="brandTonality" name="brandTonality" class="form-control" pattern="^[0-100]$" placeholder="调性指数(范围:1-100)" value="{{brandTonality}}"> |
214 | </div> | 214 | </div> |
215 | </div> | 215 | </div> |
216 | 216 |
@@ -45,7 +45,7 @@ | @@ -45,7 +45,7 @@ | ||
45 | <div class="contentpanel"> | 45 | <div class="contentpanel"> |
46 | <span class="col-sm-3 control-label">管理员筛选</span> | 46 | <span class="col-sm-3 control-label">管理员筛选</span> |
47 | <div class="col-sm-4"> | 47 | <div class="col-sm-4"> |
48 | - <select name="store-type" id="identity-type" tabindex="-1" title="" class="form-control" value="{{identity}}"><option value="-1" selected="selected">请选择身份</option> | 48 | + <select name="store-type" id="identity-type" style="height: 40px;" class="form-control" value="{{identity}}"><option value="-1" selected="selected">请选择身份</option> |
49 | <option value="1" data-valid="">品牌公司</option> | 49 | <option value="1" data-valid="">品牌公司</option> |
50 | <option value="2" data-valid="">品牌经销商</option> | 50 | <option value="2" data-valid="">品牌经销商</option> |
51 | <option value="3" data-valid="">品牌代运营商</option> | 51 | <option value="3" data-valid="">品牌代运营商</option> |
@@ -90,7 +90,7 @@ | @@ -90,7 +90,7 @@ | ||
90 | <div class="form-group"> | 90 | <div class="form-group"> |
91 | <label class="col-sm-2 control-label">注册资本 <span class="red">*</span></label> | 91 | <label class="col-sm-2 control-label">注册资本 <span class="red">*</span></label> |
92 | <div class="col-sm-8"> | 92 | <div class="col-sm-8"> |
93 | - <input type="text" id="registeredCapital" placeholder="请填写注册资本" class="form-control" required value="{{registeredCapital}}"> | 93 | + <input type="number" id="registeredCapital" placeholder="请填写注册资本" class="form-control" required value="{{registeredCapital}}" maxlength="12"> |
94 | </div> | 94 | </div> |
95 | </div> | 95 | </div> |
96 | 96 |
-
Please register or login to post a comment