Authored by 马力

Merge branch 'hotfix_资源位权限控制' into grey

# Conflicts:
#	code/static/js.jquery/module/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",
... ...
... ... @@ -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) {
... ... @@ -297,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] = [];
... ... @@ -441,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("是否确认删除?", {}),
... ... @@ -556,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;
... ... @@ -564,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();
//打开品牌选择模态
... ... @@ -642,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}
... ... @@ -651,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;
... ... @@ -722,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("");
}}
]
... ... @@ -139,4 +147,20 @@ $(document).on("click", ".delbtn", function() {
g.reload();
});
});
});
\ No newline at end of file
});
/**
* 解除锁定
*/
$(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
... ...