app-xiangsonghua/app-saas-src/script/message/messageList.js

120 lines
3.3 KiB
JavaScript
Raw Normal View History

2024-12-26 17:00:06 +08:00
//10自定义消息 20抢修管家消息 2001抢修单消息 2002抢修日志消息 30巡检管家消息 3001 巡检安排消息 3002巡检日志消息 40操作票助手消息 4001操作票审核提示消息 4002 操作票归档完成消息 50工作票助手消息 5001 工作票审核提示消息 5002工作票归档完成消息
// 报表管家7001
apiready = function() {
ctrl = {
who: null,
people: {
CUSTOM: {
name: "电务小蜜蜂",
messageTypes: [10]
},
REPAIR: {
name: "抢修管家",
messageTypes: [2001, 2002]
},
INSPECT: {
name: "巡检管家",
messageTypes: [3001, 3002]
},
OPERATE: {
name: "操作票助手",
messageTypes: [4001, 4002]
},
WORK: {
name: "工作票助手",
messageTypes: [5001, 5002]
},
ALARM: {
name: "报警管家",
messageTypes: [7001]
},
REPORT: {
name: "报表管家",
messageTypes: [7001]
}
},
init: {},
bind: {},
toggleEditMode: {},
}
ctrl.init = function() {
// 适配安卓状态栏
CommonModel.fitInStatusBar();
//获取userId
var userId = $api.getStorage("userId");
ctrl.userId = userId;
//获取传递进来的参数:消息类型
var who = api.pageParam.type;
//显示who
$("#title").text(ctrl.people[who].name);
//打开frame
var headerHeight = parseInt($api.cssVal($api.dom("header"), "height"));
var windowWidth = parseInt($api.cssVal($api.dom("body"), "width"));
var windowHeight = parseInt($api.cssVal($api.dom("body"), "height"));
//打开frame
api.openFrame({
name: "messageListFrame",
url: "./messageListFrame.html",
rect: {
x: 0,
y: headerHeight,
w: windowWidth,
h: windowHeight - headerHeight
},
pageParam: {
type: who
}
});
ctrl.bind();
}
ctrl.bind = function() {
//返回按钮
$("#back").on("touchend", function() {
api.closeWin({});
})
// 点击编辑按钮
$("#edit").on("touchend", function() {
ctrl.toggleEditMode();
})
// 接受到子页面发送过来的关闭编辑模式的请求 关闭编辑模式
api.addEventListener({
name: 'requestCancelEditMode'
}, function(ret, err) {
ctrl.toggleEditMode();
});
}
ctrl.toggleEditMode = function() {
var editBtn = $("#edit");
var isEditting = editBtn.data('is-editting');
if (!isEditting) {
api.sendEvent({
name: 'openEditMode'
});
editBtn.data('is-editting', '1');
editBtn.text('取消');
} else {
api.sendEvent({
name: 'cancelEditMode'
});
editBtn.data('is-editting', '0');
editBtn.text('编辑');
}
}
ctrl.init();
}