Authored by weiqingting

bug修改

... ... @@ -45,6 +45,7 @@ dropDown.prototype={
},
processResults: function (data, params) {
params.page = params.page || 1;
data.data.data.unshift({id:'-1',text:"请选择"});
return {
results: data.data.data
}
... ...
... ... @@ -127,7 +127,8 @@ edit.prototype={
if($('input[type="file"]').length>0){
$('input[type="file"]').each(function(){
var src=$(this).attr("value");
var Temp='<ul class="upload-image-list">';
var _id=$(this).attr("id")||$(this).attr("name");
var Temp='<ul class="upload-image-list" id="img-'+_id+'">';
Temp+='<li class="fileinput-button">';
Temp+='<a class="fileinput-button-icon" href="javascript:void(0);">';
if(src){
... ... @@ -156,7 +157,9 @@ edit.prototype={
'onStart': function() {
},
'onCancel': function() {
console.log('no file selected');
// var _id=$(this).attr("id")||$(this).attr("name");
// $(".fileinput-button-icon","#img-"+_id).html("+");
// $(this).attr("value","");
}
});
}
... ...
... ... @@ -165,7 +165,7 @@ grid.prototype={
if (column.name) c.attr({ columnname: column.name });
var h_t = column.display || "";
c.html(h_t);
if(column.checkbox) c.html("<input type='checkbox' class='wqt_all' />");
if(column.type) c.html("<input type='"+column.type+"' class='wqt_all' />");
return column.hidden?"":c;
},
ajax:function(param){
... ... @@ -245,8 +245,8 @@ grid.prototype={
if (!row || !col) return "";
var value = col.name ? row[col.name] : null;
var content = "";
if(col.checkbox){
content="<input type='checkbox' name='"+col.name+"' class='wqt_checkbox' data-index='"+row.__index+"'>";
if(col.type){
content="<input type='"+col.type+"' name='"+col.name+"' class='wqt_checkbox' data-index='"+row.__index+"'>";
}else if (col.render) {
content = col.render.call(g, row, value, col);
} else {
... ... @@ -265,12 +265,14 @@ grid.prototype={
$(g.grid).on("change",".wqt_all",function(){
var selected=$(".wqt_all").prop("checked");
$(".wqt_checkbox").prop("checked",selected);
if(selected){
console.log(g.rows);
g.selected=g.rows;
}else{
g.selected.length=0;
}
g.selected.length=0;
$(".wqt_checkbox").each(function(){
var checked=$(this).prop("checked");
var index=$(this).data("index");
if(checked){
g.selected.push(g.rows[index]);
}
});
});//g.selected
//$(".wqt_checkbox").prop("checked",true);
... ...
... ... @@ -33,13 +33,16 @@ var $ = require('jquery'),
});
},
selectManagerName:function(id,eqid){
if(!~id){
return false;
}
common.util.__ajax({
url:'/supplier/storeadmin/managerName',
data:{
identity:id//$('#identity-type option:selected').val()
}
},function(res){
$('#manager-name').html('');
$('#manager-name').html('<option value="">请选择管理员</option>');
if(res.data&&res.data.length>0){
$.each(res.data,function(index,item){
var $option=$("<option></option>");
... ... @@ -50,7 +53,8 @@ var $ = require('jquery'),
$option.html(item.truename);
$("#manager-name").append($option);
})
}
};
new common.dropDown({el:"#manager-name"});
},true);
},
... ... @@ -80,6 +84,7 @@ var $ = require('jquery'),
});
});
new common.dropDown({el:"#store-name",ajax:"shopsRest"});
new common.dropDown({el:"#manager-name"});
//
$('#identity-type').on('change',function(){
Bll.selectManagerName($(this).val());
... ...
... ... @@ -258,13 +258,14 @@ var Bll={
}
}
var g=new common.grid({
el:"#baseTable",
parms:function(){
return {brandId: $('#brandname').val()}
},
columns:[
{display:"选择","checkbox":true},
{display:"选择","type":"checkbox"},
{display:"品牌",render:function(item){
item.brandName=$.trim($("#brandname").text().replace(/选择品牌/g,''));
return item.brandName;
... ... @@ -305,7 +306,6 @@ e.on("render",function(){
});
(!!~$("#shopsType").val())?$("#modalId").prop("disabled",false):$("#modalId").prop("disabled",true);
//修改
if($("#shopRelationList").val()){
var a=JSON.parse($("#shopRelationList").val());
... ... @@ -322,18 +322,39 @@ e.on("bind",function(){
});
$("#shopsType").change(function(){
(!!~$("#shopsType").val())?$("#modalId").prop("disabled",false):$("#modalId").prop("disabled",true);
if(!!~$("#shopsType").val()){
$("#modalId").prop("disabled",false);
}else{
$("#modalId").prop("disabled",true);
}
if(g2.grid){
g2.__rows.length=0;
g2.reload();
}
});
$("#modalId").click(function(){
var __feild="brandId";
if((+$("#shopsType").val()==1)){
g.options.columns[0].type="radio";
__feild="brandId";
g2.__rows.length=0;
}else{
g.options.columns[0].type="checkbox";
__feild="supplierId";
}
//common.util.__template($("#template").html(),{})
common.dialog.confirm("添加供应商关系",$("#template").html(),function(){
console.log(g.selected);
$.each(g.selected,function(index,item){
//item.supplierId
var i=0;
$.each(g2.__rows,function(index1,item1){
if(item1.brandId==item.brandId){
if(item1[__feild]==item[__feild]){
i++;
}
});
... ... @@ -356,9 +377,7 @@ e.on("bind",function(){
});
$("#updateBrand").on("click",".delete",function(){
console.log(g2.__rows);
g2.__rows.splice($(this).data("index"),1);
console.log(g2.__rows);
g2.reload();
});
});
... ... @@ -410,10 +429,15 @@ e.on("validate",function(){
});
e.on("validate",function(){
_arr.shopRelation=JSON.stringify(g2.rows);
if(!_arr.shopRelation){
var i=0;
for (var key in g2.rows) {
i++;
}
if(!i){
return "请选择关联品牌";
}
_arr.shopRelation=JSON.stringify(g2.rows);
});
e.init();
... ...
... ... @@ -69,11 +69,13 @@ var ENUM={// 审核状态;100 暂存 200 待审核 300 审核通过 900 驳
if(+item.checkStatus!=200){
HtmArr.push('<a href="/supplier/store/update/'+item.shopsId+'" href="javascript:void(0);" class="btn btn-success btn-xs">编辑</a>');
}
if(+item.status){
// 1开启 0 关闭
HtmArr.push('<a data-index="'+item.__index+'" href="javascript:void(0);" class="closeshops btn btn-success btn-xs">开店</a>');
}else{
HtmArr.push('<a data-index="'+item.__index+'" href="javascript:void(0);" class="openshops btn btn-danger btn-xs">关店</a>');
if(+item.checkStatus!=900){
if(+item.status){
// 1开启 0 关闭
HtmArr.push('<a data-index="'+item.__index+'" href="javascript:void(0);" class="openshops btn btn-success btn-xs">开店</a>');
}else{
HtmArr.push('<a data-index="'+item.__index+'" href="javascript:void(0);" class="closeshops btn btn-danger btn-xs">关店</a>');
}
}
}
return HtmArr.join('');
... ...
... ... @@ -3,6 +3,12 @@ var edit=require('../common/edit');
var e=new edit("#basicForm");
e.on("validate",function(){
//registeredCapital
var registeredCapital=$.trim($("#registeredCapital").val());
//+registeredCapital<999999999.99
if(!/^(([0-9]{1,9})(\.[0-9]{1,2}){0,1})$/.test(registeredCapital)){
return "注册资本格式无效(0~999999999.99)";
}
var contactPhone=$.trim($("#contactPhone").val());
if(contactPhone){
... ...
... ... @@ -6,19 +6,19 @@ exports.uploadFile=function(req,res){
// TODO 代理上传
// 方法1
if(req.is("multipart/form-data")){
req.body.file=fs.createReadStream(req.files[req.body.filename].path);
request.post({url:domain+'/fileupload/upload',formData:req.body},function optionalCallback(err, httpResponse, body){
res.json(JSON.parse(body));
});
}else{
res.json({code:"500",message:"请求类型错误"});
}
// res.json({
// "code":200,
// "data" : "https://ss1.baidu.com/6ONXsjip0QIZ8tyhnq/it/u=1444256491,538988776&fm=80",
// "message":"success"
// if(req.is("multipart/form-data")){
// req.body.file=fs.createReadStream(req.files[req.body.filename].path);
// request.post({url:domain+'/fileupload/upload',formData:req.body},function optionalCallback(err, httpResponse, body){
// res.json(JSON.parse(body));
// });
// }else{
// res.json({code:"500",message:"请求类型错误"});
// }
res.json({
"code":200,
"data" : "https://ss1.baidu.com/6ONXsjip0QIZ8tyhnq/it/u=1444256491,538988776&fm=80",
"message":"success"
});
//方法2
// req.pipe(request.post(domain+'/fileupload/upload'))
... ...
... ... @@ -210,7 +210,7 @@
<div class="form-group">
<label class="col-sm-2 control-label">调性指数</label>
<div class="col-sm-2">
<input type="text" id="brandTonality" name="brandTonality" class="form-control" pattern="^[0-100]$" placeholder="调性指数(范围:1-100)" value="{{brandTonality}}">
<input type="number" id="brandTonality" name="brandTonality" class="form-control" pattern="^[0-100]$" placeholder="调性指数(范围:1-100)" value="{{brandTonality}}">
</div>
</div>
... ...
... ... @@ -45,7 +45,7 @@
<div class="contentpanel">
<span class="col-sm-3 control-label">管理员筛选</span>
<div class="col-sm-4">
<select name="store-type" id="identity-type" tabindex="-1" title="" class="form-control" value="{{identity}}"><option value="-1" selected="selected">请选择身份</option>
<select name="store-type" id="identity-type" style="height: 40px;" class="form-control" value="{{identity}}"><option value="-1" selected="selected">请选择身份</option>
<option value="1" data-valid="">品牌公司</option>
<option value="2" data-valid="">品牌经销商</option>
<option value="3" data-valid="">品牌代运营商</option>
... ...
... ... @@ -90,7 +90,7 @@
<div class="form-group">
<label class="col-sm-2 control-label">注册资本 <span class="red">*</span></label>
<div class="col-sm-8">
<input type="text" id="registeredCapital" placeholder="请填写注册资本" class="form-control" required value="{{registeredCapital}}">
<input type="number" id="registeredCapital" placeholder="请填写注册资本" class="form-control" required value="{{registeredCapital}}" maxlength="12">
</div>
</div>
... ...