|
@@ -1,10 +1,22 @@
|
|
|
function vermanagementGenPage() {
|
|
|
- var page = '<div id="vermanagement_page">\
|
|
|
- <div id="vermanagement_tip" align="center" style="display: block;">\
|
|
|
- <div class="color_descroption_gray"\
|
|
|
- style="width:auto;margin-top:200px;font-size:18px;line-height:120%;">\
|
|
|
- <span>相关功能正在开发中,敬请期待!</span>\
|
|
|
+ var page = '<div id="vermanagement_page" style="display: block;">\
|
|
|
+ <div class="maintitle">\
|
|
|
+ <div>终端版本管理</div>\
|
|
|
+ <div class="page_description_text">管理本地的终端应用程序版本,支持删除和版本切换</div>\
|
|
|
</div>\
|
|
|
+ <div id="vermanagementContent">\
|
|
|
+ <div class="clearboth" id="apn_list" style="padding-top:70px;">\
|
|
|
+ <div class="table_top">\
|
|
|
+ <div class="table_list_title">终端应用版本列表\
|
|
|
+ </div>\
|
|
|
+ <div class="pull-right"> \
|
|
|
+ </div>\
|
|
|
+ </div>\
|
|
|
+ <div class="border_left border_right color_Darkgray" style="width:678px;padding-top:-1px;">\
|
|
|
+ <div id="version_lists" class="clearboth" style="width:100%;overflow:hidden;">\
|
|
|
+ </div>\
|
|
|
+ </div>\
|
|
|
+ <div class="table_bottom">\
|
|
|
</div>\
|
|
|
</div>';
|
|
|
|
|
@@ -18,7 +30,184 @@ function vermanagementGenPage() {
|
|
|
|
|
|
var vermanagementController = (function() {
|
|
|
|
|
|
- function initPage() {
|
|
|
+ var CONST = {
|
|
|
+ SWITCH_ON: '1',
|
|
|
+ PROFILE_MAX_NUM: 100
|
|
|
+ };
|
|
|
+
|
|
|
+ var weblistCount = 0;
|
|
|
+ var isNewWebConfig = true;
|
|
|
+
|
|
|
+ var modifyIndex = -1;
|
|
|
+ var profilesArray = [];
|
|
|
+ var modifyProfile = {};
|
|
|
+
|
|
|
+ function loadData(flag) {
|
|
|
+ let req = new Request();
|
|
|
+ req.filter1 = 0;
|
|
|
+ req.filter2 = 0;
|
|
|
+ req.filter3 = 0;
|
|
|
+ req.filter4 = '';
|
|
|
+
|
|
|
+ profilesArray = [];
|
|
|
+ weblistCount = 0;
|
|
|
+
|
|
|
+ if(typeof flag === 'undefined') {
|
|
|
+ utilStartSubmitDialog();
|
|
|
+ }
|
|
|
+ RVC.ResourceWatcherEntity.GetTerminalVersionList(req, function(ret) {
|
|
|
+ if(typeof flag === 'undefined'){
|
|
|
+ utilStopSubmitDialog();
|
|
|
+ }
|
|
|
+ console.log('result: ' + ret.errorCode);
|
|
|
+ if (ret.errorCode === 0) {
|
|
|
+ let result = JSON.parse(ret[RVC.ResourceWatcherEntity.sigResponseUUID])
|
|
|
+ console.log('count: ' + result.index.length + ' ' + result);
|
|
|
+
|
|
|
+ if (result.index.length === 0) {
|
|
|
+ $('#version_lists').css('height', 0);
|
|
|
+ $('#version_lists').hide();
|
|
|
+ return;
|
|
|
+ } else if (result.index.length <= 8) {
|
|
|
+ $('#version_lists').css('height', (result.index.length * 70 - 12) + result.index.length + 'px');
|
|
|
+ } else {
|
|
|
+ $('#version_lists').css('height', '561px');
|
|
|
+ }
|
|
|
+ $('#version_lists').show();
|
|
|
+ $('#version_lists').empty();
|
|
|
+ RVC.Scroll.initScroll('#version_lists');
|
|
|
+ for (var n = 0; n < result.index.length; n++)
|
|
|
+ {
|
|
|
+ var templateData = {
|
|
|
+ profileItemIndex: result.index[n],
|
|
|
+ profileItemName: result.version[n],
|
|
|
+ profileItemRemark: result.remark[n],
|
|
|
+ profileItemStatus: false
|
|
|
+ };
|
|
|
+ if(result.index[n] == result.current) {
|
|
|
+ templateData.profileItemStatus = true;
|
|
|
+ }
|
|
|
+ profilesArray.push(templateData);
|
|
|
+
|
|
|
+ var profileHtml;
|
|
|
+ if (n === result.index.length - 1) {
|
|
|
+ profileHtml = '<div id="version_list_{{profileItemIndex}}" style="height:59px;cursor:pointer;" class="list_item_hover">';
|
|
|
+ if (templateData.profileItemStatus) {
|
|
|
+ profileHtml += '<div id="version_list_name_{{profileItemIndex}}" class="pull-left padding-left-20" style="height:45px;padding-top:14px;width:600px;">';
|
|
|
+ } else {
|
|
|
+ profileHtml += '<div id="version_list_name_{{profileItemIndex}}" class="pull-left padding-left-20" style="height:45px;padding-top:14px;width:600px;" onclick="RVC.VersionController.ActiveVersion({{profileItemIndex}})">';
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ profileHtml = '<div id="version_list_{{profileItemIndex}}" class="border_bottom list_item_hover" style="height:70px;cursor:pointer;">';
|
|
|
+ if (templateData.profileItemStatus) {
|
|
|
+ profileHtml += '<div id="version_list_name_{{profileItemIndex}}" class="pull-left padding-left-20" style="height:56px;padding-top:14px;width:600px;">';
|
|
|
+ } else {
|
|
|
+ profileHtml += '<div id="version_list_name_{{profileItemIndex}}" class="pull-left padding-left-20" style="height:56px;padding-top:14px;width:600px;" onclick="RVC.VersionController.ActiveVersion({{profileItemIndex}})">';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (templateData.profileItemStatus) {
|
|
|
+ profileHtml += '<pre class="version_profile_name_{{profileItemIndex}}" style="font-size:16px;margin-top:0px;"><span class="version_profile_itemname pull-left" style="line-height:21px;" title="{{profileItemName}}">{{profileItemName}}</span><span class="pull-left" style="line-height:21px;">(当前应用)</span><div class="clearboth"></div></pre>';
|
|
|
+ } else {
|
|
|
+ profileHtml += '<pre class="version_profile_name_{{profileItemIndex}}" style="font-size:16px;margin-top:0px;"><span class="version_profile_itemname" title="{{profileItemName}}">{{profileItemName}}</span></pre>';
|
|
|
+ }
|
|
|
+ profileHtml += '<div class="version_version_name_{{profileItemIndex}} color_descroption_gray version_profile_itemapnname" style="margin-top:-10px;font-size:14px;" title="{{profileItemRemark}}">{{profileItemRemark}}</div></div>';
|
|
|
+ if (templateData.profileItemStatus) {
|
|
|
+ profileHtml += '<div class="pull-right"></div></div>';
|
|
|
+ } else {
|
|
|
+ if (n === 0) {
|
|
|
+ profileHtml += '<div class="pull-right"><div class="btn_delete mobileconnet_btn_delete" onclick="RVC.VersionController.RemoveVersion({{profileItemIndex}})" > </div></div></div>';
|
|
|
+ } else {
|
|
|
+ profileHtml += '<div class="pull-right"><div class="btn_delete mobileconnet_btn_delete" onclick="RVC.VersionController.RemoveVersion({{profileItemIndex}})" > </div></div></div>';
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $('#version_lists .scroll_text').secureAppend(profileHtml, templateData);
|
|
|
+
|
|
|
+ }
|
|
|
+ weblistCount = result.index.length;
|
|
|
+
|
|
|
+ } else if(typeof flag === 'undefined') {
|
|
|
+ RVC.ResourceWatcherEntity.commErrorCallback(ret);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ function preShowVersionList()
|
|
|
+ {
|
|
|
+ $('#version_lists').show();
|
|
|
+ $('#version_lists').empty();
|
|
|
+ RVC.Scroll.initScroll('#version_lists');
|
|
|
+ }
|
|
|
+
|
|
|
+ RVC.VersionController = RVC.ObjController.extend({
|
|
|
+
|
|
|
+ ActiveVersion: function(index)
|
|
|
+ {
|
|
|
+ utilStartConfirmDialog("确定要切换使用当前版本吗?", function(){
|
|
|
+ let req = new Request();
|
|
|
+ req.operation = 1; //切换版本
|
|
|
+ req.value = profilesArray[index].profileItemName;
|
|
|
+ req.additional1 = 0;
|
|
|
+ req.additional2 = 0;
|
|
|
+ req.additional3 = '';
|
|
|
+
|
|
|
+ utilStartSubmitDialog();
|
|
|
+ RVC.ResourceWatcherEntity.ManipulateVersion(req, function(ret) {
|
|
|
+ utilStopSubmitDialog();
|
|
|
+ if (ret.errorCode === 0) {
|
|
|
+ let result = JSON.parse(ret[RVC.ResourceWatcherEntity.sigResponseUUID])
|
|
|
+ if(result.result == 0) {
|
|
|
+ utilStartConfirmDialog("切换成功!点击确认立即重启应用以使用版本", function(){
|
|
|
+ RVC.HealthmanagerEntityCtrl.RestartApp(true);
|
|
|
+ })
|
|
|
+ //preShowVersionList();
|
|
|
+ //loadData();
|
|
|
+ } else {
|
|
|
+ utilStartAlertDialog("操作失败:[" + result.result + "] " + result.msg);
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ RVC.ResourceWatcherEntity.commErrorCallback(ret);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ RemoveVersion: function(index)
|
|
|
+ {
|
|
|
+ utilStartConfirmDialog("确定要删除该版本吗?", function() {
|
|
|
+ let req = new Request();
|
|
|
+ req.operation = 2; //删除
|
|
|
+ req.value = profilesArray[index].profileItemName;
|
|
|
+ req.additional1 = 0;
|
|
|
+ req.additional2 = 0;
|
|
|
+ req.additional3 = '';
|
|
|
+
|
|
|
+ utilStartSubmitDialog();
|
|
|
+ RVC.ResourceWatcherEntity.ManipulateVersion(req, function(ret) {
|
|
|
+ utilStopSubmitDialog();
|
|
|
+ if (ret.errorCode === 0) {
|
|
|
+ let result = JSON.parse(ret[RVC.CenterSettingEntity.sigResponseUUID])
|
|
|
+ preShowVersionList();
|
|
|
+ loadData();
|
|
|
+ } else {
|
|
|
+ RVC.ResourceWatcherEntity.commErrorCallback(ret);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+ function bindEvents() {
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ function initPage()
|
|
|
+ {
|
|
|
+ preShowVersionList();
|
|
|
+ loadData(true);
|
|
|
|
|
|
}
|
|
|
|
|
@@ -26,13 +215,20 @@ var vermanagementController = (function() {
|
|
|
|
|
|
function init() {
|
|
|
|
|
|
+ initPage();
|
|
|
+
|
|
|
if (fistTime) {
|
|
|
fistTime = false;
|
|
|
+ bindEvents();
|
|
|
}
|
|
|
- initPage();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ function destory() {
|
|
|
+ clearAllErrorMsg();
|
|
|
}
|
|
|
|
|
|
- return { init: init };
|
|
|
+ return { init: init, destory: destory };
|
|
|
}());
|
|
|
|
|
|
window.vermanagementRenderPage = function () {
|