Authored by 马力

Merge branch 'master' into dev5.3

# Conflicts:
#	dist/yohobuy-portal-fe/5.0.2/jquery/resource.resourceManage.ContentManage.js
... ... @@ -40,9 +40,14 @@ module.exports=function(app) {
/*删除资源位下所有tab*/
app.post("/resources/deleteAllResourceByCode","resourceManage_deleteAllResourceByCode");
app.post("/resources/updateLock","resourceManage_updateLock");
/*根据id获取资源内容*/
app.post("/resources/resContentIndex","resourceManage_resContentIndex");
/*根据是否可编辑*/
app.post("/resources/checkLock","resourceManage_checkLock");
/*添加资源内容*/
app.post("/resources/addResContent","resourceManage_addResContent");
... ...
... ... @@ -51,6 +51,14 @@ module.exports={
{name: "code", type: "string"}
]
},
updateLock:{
title: "解除锁定",
url: "/resources/updateLock",
params: [
{name: "id", type: "number"},
{name: "status", type: "number"}
]
},
getUrlAction:{
title: "获取跳转链接",
url: "/resources/getUrlAction"
... ... @@ -62,6 +70,13 @@ module.exports={
{name: "id", type: "number"}
]
},
checkLock:{
title: "查询是否可编辑",
url: "/resources/checkLock",
params: [
{name: "id", type: "number"}
]
},
addResContent:{
title: "添加资源内容",
url: "/resources/addResContent",
... ...
... ... @@ -24,4 +24,7 @@ module.exports = function (app){
//根据品牌选择供应商
app.post("/supplier/storeadmin/supplierlist","shopAdministrator_selectSupplierByBrandId");
// 查询店铺管理员列表,筛选框
app.post("/supplier/storeadmin/adminList", "shopAdministrator_getAllShopAdminProfile");
}
\ No newline at end of file
... ...
... ... @@ -6,7 +6,9 @@ module.exports={
url:"/ShopsAdminRest/getShopsAdminList",
params:[
{name: 'page', type: 'Number'},
{name: 'size', type: 'Number'}
{name: 'size', type: 'Number'},
{name: 'shopsId', type: 'Number'},
{name: 'adminPid', type: 'Number'}
]
},
... ... @@ -46,6 +48,11 @@ module.exports={
{name:"brandId",type:"Number"}
]
},
getAllShopAdminProfile:{
title: "获取所有的店铺管理员信息",
url: "/ShopsAdminRest/getAllShopAdminProfile"
}
}
}
... ...
... ... @@ -6,6 +6,24 @@
<a class="add btn btn-success"><i class="fa fa-plus"></i> 创建店铺管理员关系</a>
</div>
<input type="hidden" id="url" value="/supplier/storeadmin/indexPage">
<div class="panel-body">
<div class="row">
<div class="panel-col2">
<select name="shop-name" id="shop-name" style="width: 280px;" tabindex="-1" title="" class="form-control">
<option value="-1">请选择店铺</option>
</select>
</div>
<div class="panel-col2">
<select name="admin-name" id="admin-name" style="width: 280px;" tabindex="-1" title="" class="form-control">
<option value="-1">请选择管理员</option>
</select>
</div>
<div class="panel-col2">
<a id="filter-btn" href="javascript:;" class="btn btn-info">筛选</a>
<a id="all-btn" href="" class="btn btn-info">全部</a>
</div>
</div>
</div>
<div class="panel panel-primary-head">
<div id="basicTable_wrapper" class="dataTables_wrapper no-footer">
<div class="dataTables_length" id="basicTable"></div>
... ...
... ... @@ -43,7 +43,7 @@
aria-describedby="basic-addon2" required>
<span class="input-group-addon" id="basic-addon2">.yohobuy.com</span>
</div>
<p style="margin-top: 10px"><span class="red">注:1. 4-32个字符;2. 只能填英文、数字和破折号-,不区分大小写,不能以破折号开头或者结尾</span></p>
<p style="margin-top: 10px"><span class="red">注:1. 1-32个字符;2. 只能填英文、数字和破折号-,不区分大小写,不能以破折号开头或者结尾</span></p>
</div>
</div>
<div class="form-group">
... ...
... ... @@ -10,6 +10,7 @@ require('../../../common/util/datepicker');
var resources = [];
var times = [];
var currIndex = 0;
var lockStatus = 0;
//资源id
var param = location.href.substring(location.href.lastIndexOf("/") + 1);
common.util.__ajax({
... ... @@ -20,6 +21,13 @@ common.util.__ajax({
resources = res.data;
console.log(resources);
}, true);
common.util.__ajax({
url: "/resources/updateLock",
data: {id: param,
status:1},
async: false
}, function (res) {
}, true);
/*配置模块*/
var edit = new common.edit2(".modal-body", {
... ... @@ -68,6 +76,9 @@ var Bll = {
value: "保存",
callback: function () {
console.log(module.contentData);
if(!checkLockStatus()){
return false;
}
var couponFlag = true;
if (Validate[module.contentData.template_name]) {
Validate[module.contentData.template_name].forEach(function (item) {
... ... @@ -204,6 +215,7 @@ var Bll = {
}
for(var key2 in res.data.brands[key]){
var item=res.data.brands[key][key2];
if (!item) { continue; }
Brand[name] = Brand[name] || [];
Brand[name].push(item);
Bll.Brands1[item.id] = item;
... ... @@ -296,7 +308,6 @@ function Unique(Array,key) {
Bll.__render("#content-list", "content-template", resources[currIndex]);
Bll.__render(".contents", "template_content_btns", {btns: Button});
Bll.__render("#times-list", "times-template", {times:times, selected:0});
/*第二部,把楼层数据转化成数组*/
for(var i = 0; i < resources.length; i++) {
Bll.contentDatas[i] = [];
... ... @@ -440,6 +451,9 @@ $(document).on("change", ".observe", function () {
/*删除*/
$(document).on("click", ".del", function () {//删除
if(!checkLockStatus()){
return false;
}
var index = $(this).data("index");
common.dialog.confirm("警告",
common.util.__template2("是否确认删除?", {}),
... ... @@ -555,6 +569,7 @@ function secondsToStrDate(seconds) {
return common.util.__dateFormat(t, "yyyy-MM-dd hh:mm:ss");
}
function dateStrToSeconds(date) {
if(date) {
return new Date(date).getTime() / 1000;
... ... @@ -563,6 +578,23 @@ function dateStrToSeconds(date) {
return 0;
}
function checkLockStatus(){
common.util.__ajax({
url: "/resources/checkLock",
data: {id: param},
async: false
}, function (res) {
lockStatus = res.data;
}, true);
if(lockStatus == '2') {
common.util.__tip("该资源位已被锁定,不能操作");
return false;
}else{
return true;
}
}
//获取品牌
Bll.getBrands();
//打开品牌选择模态
... ... @@ -641,6 +673,9 @@ $(document).on("click", '.icon-number', function () {
//**********************************************************************************/
//复制
$(document).on("click", "#copyTab", function() {
if(!checkLockStatus()){
return false;
}
common.util.__ajax({
url: "/resources/copyResContent",
data: {rId:resources[currIndex].resource.id}
... ... @@ -650,6 +685,9 @@ $(document).on("click", "#copyTab", function() {
});
//保存时间
$(document).on("click", "#saveTime", function() {
if(!checkLockStatus()){
return false;
}
if(times[currIndex].status == "进行中") {
common.util.__tip("进行中的页面不能更改时间");
return false;
... ... @@ -721,6 +759,9 @@ $(document).on("click", "#delTab", function() {
/*保存事件*/
$(document).on("click", "#sub_btn", function () {
if(!checkLockStatus()){
return false;
}
var data = {
"content": {},
"data_id": {},
... ...
... ... @@ -47,15 +47,23 @@ var g = new common.grid({
{display: "分类", name: "sortName"},
{display: "平台", name: "platformName"},
{display: "位置码", name: "code"},
{display: "匹配码", name: "matchCode"},
{display: "创建时间", name: "", render: function(item) {
return Bll.getLocalTime(item.createTime);
}},
{display: "锁定人", name: "lockPersonName"},
{display: "锁定时间", name: "",render:function(item){
if(item.lockPersonName !=''){
return Bll.getLocalTime(item.lockTime);
}
}},
{display: "操作", name: "",render: function(item) {
var arr = [];
arr.push('<a target="_blank" class="btn btn-xs btn-info contentManage" data-index="' + item.__index + '" href="/resource/content/index/' + item.id + '">内容管理</a>');
arr.push('<a class="btn btn-xs btn-primary add2" data-index="' + item.__index + '">编辑</a>');
arr.push('<a class="btn btn-xs btn-danger delbtn" data-index="' + item.__index + '">删除</a>');
if(item.lockPersonName !=''){
arr.push('<a class="btn btn-xs btn-danger updateLockBtn" data-index="' + item.__index + '">解除锁定</a>');
}
return arr.join("");
}}
]
... ... @@ -140,3 +148,19 @@ $(document).on("click", ".delbtn", function() {
});
});
});
/**
* 解除锁定
*/
$(document).on("click", ".updateLockBtn", function() {
var item = g.rows[$(this).data("index")];
common.dialog.confirm("警告", "是否确认解除锁定?",function() {
common.util.__ajax({
url: "/resources/updateLock",
data: {id: item.id,
status:0}
}, function () {
g.reload();
});
});
});
\ No newline at end of file
... ...
... ... @@ -3,12 +3,23 @@
var $ = require('jquery'),
common=require('../../common/common');
// 筛选项
new common.dropDown({el:"#shop-name",ajax:"shopsRest"});
selectAllManagerInfo();
var g=new common.grid({
el:'#basicTable',
parms: function() {
return {
'shopsId': common.util.__input('shop-name'),
'adminPid': common.util.__input('admin-name')
}
},
columns:[
{display:"ID",name:"id"},
{display:"店铺名称",name:"shopName"},
{display:"店铺管理员",name:"adminName"},
{display:"部门",name:"deptName"},
{display:"创建时间",name:"createTime"},
{display:"更新时间",name:"updateTime"},
{display:"操作",name:"",render:function(item){
... ... @@ -51,7 +62,11 @@ var $ = require('jquery'),
if(+item.pid==eqid){
$option.attr("selected","selected");
}
$option.html(item.truename);
var content = item.truename;
if(item.deptName) {
content += '(' + item.deptName +')';
}
$option.html(content);
$("#manager-name").append($option);
})
};
... ... @@ -114,3 +129,34 @@ var $ = require('jquery'),
});
function selectAllManagerInfo() {
common.util.__ajax({
url: '/supplier/storeadmin/adminList'
}, function(res) {
$('#admin-name').html('<option value="">请选择管理员</option>');
if(res.data&&res.data.length>0){
$.each(res.data,function(index,item){
var $option=$("<option></option>");
$option.attr("value",item.pid);
var content = item.truename;
// 将"真实姓名"为空的数据排除
if(content === undefined || content.length === 0) {
return;
}
if(item.deptName) {
content += '(' + item.deptName +')';
}
$option.html(content);
$("#admin-name").append($option);
})
};
new common.dropDown({el:"#admin-name"});
}, true);
}
$(document).on('click', '#filter-btn', function() {
g.reload(1);
});
... ...
... ... @@ -49,11 +49,13 @@ var g = new common.grid({
render: function(item) {
console.log(item);
if (item.brands instanceof Array && item.brands.length > 0) {
var html = '';
var brandArr = [];
$.each(item.brands, function(i, value) {
html += value.brandName + '<br>';
if($.inArray(value.brandName, brandArr) === -1) {
brandArr.push(value.brandName);
}
});
return html;
return '<p>' + brandArr.join('</p><p>') + '</p>';
} else {
return '';
}
... ...
... ... @@ -276,7 +276,7 @@ e.on("validate", function() {
if(shopDomainVal) {
var shopDomainPattern = new RegExp("^[a-zA-Z0-9]([a-zA-Z0-9-])*[a-zA-Z0-9]$");
if(shopDomainVal.length < 4 || shopDomainVal.length > 32) {
if(shopDomainVal.length < 1 || shopDomainVal.length > 32) {
return "店铺域名输入有误!";
}
... ... @@ -289,7 +289,7 @@ e.on("validate", function() {
e.init();
var submit=function(callback){
e.submit($("#storeForm").attr("action"),function(option){
var result = e.submit($("#storeForm").attr("action"),function(option){
option.data=$.extend({},option.data,_arr);
option.data.shopIntro = UMshopintro.getContent();
console.log(option.data);
... ... @@ -301,24 +301,38 @@ var submit=function(callback){
},'growl-success');
}else{
e.$tip(res.message);
$(".btn-cun").removeAttr("disabled");
$(".btn-success").removeAttr("disabled");
}
return false;
},
option.error=function(res){
e.$tip("提交失败");
$(".btn-cun").removeAttr("disabled");
$(".btn-success").removeAttr("disabled");
}
callback&&callback(option.data);
});
// 发生校验错误
if(result === false) {
$(".btn-cun").removeAttr("disabled");
$(".btn-success").removeAttr("disabled");
}
};
//提交
$(".btn-success").click(function(){
// 为防止同时触发 "提交审核" 和 "暂存",对按钮做灰化处理
$(".btn-cun").attr("disabled", true);
submit(function(item){
item.onCheck=1;
});
});
//暂存
$(".btn-cun").click(function(){
// 为防止同时触发 "提交审核" 和 "暂存",对按钮做灰化处理
$(".btn-success").attr("disabled", true);
submit(function(item){
item.onCheck=0;
});
... ...
... ... @@ -16,26 +16,30 @@ var t = new common.tab({
g.options.columns[1].name = "shopsName";
g.options.columns[2] = {
display: "包含品牌", name: "brands", render: function (item) {
var str = '';
var brandArr = [];
if (item.brands) {
$.each(item.brands, function (index, a) {
str += '<p>' + a.brandName + '</p>';
if($.inArray(a.brandName, brandArr) === -1) {
brandArr.push(a.brandName);
}
});
}
return str;
return '<p>' + brandArr.join('</p><p>') + '</p>';
}
};
} else {
g.options.columns[1].name = "shopName";
g.options.columns[2] = {
display: "包含品牌", name: "shopRelationList", render: function (item) {
var str = '';
var brandArr = [];
if (item.shopRelationList) {
$.each(item.shopRelationList, function (index, a) {
str += '<p>' + a.brandName + '</p>';
if($.inArray(a.brandName, brandArr) === -1) {
brandArr.push(a.brandName);
}
});
}
return str;
return '<p>' + brandArr.join('</p><p>') + '</p>';
}
};
... ... @@ -78,13 +82,16 @@ var g = new common.grid({
{display: "店铺名称", name: "shopName"},
{
display: "包含品牌", name: "shopRelationList", render: function (item) {
var str = '';
var brandArr = [];
if (item.shopRelationList) {
$.each(item.shopRelationList, function (index, a) {
str += '<p>' + a.brandName + '</p>';
if($.inArray(a.brandName, brandArr) === -1) {
brandArr.push(a.brandName);
}
});
}
return str;
return '<p>' + brandArr.join('</p><p>') + '</p>';
}
},
{display: "创建时间", name: "createTime"},
... ...