parent
7efdc5d699
commit
7073155320
@ -0,0 +1,4 @@
|
||||
/// <reference path="../../includes.d.ts" />
|
||||
declare module Developer {
|
||||
function createCurrentSubNavBar($scope: any, $location: any, $routeParams: any): any;
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
/// <reference path="../../includes.d.ts" />
|
||||
/// <reference path="developerPlugin.d.ts" />
|
||||
declare module Developer {
|
||||
class OptionsParams {
|
||||
pagerSizeOption: number[];
|
||||
dataType: any;
|
||||
currentTableSize: number;
|
||||
dataBatch: any;
|
||||
labels: {};
|
||||
currentPageNum: number;
|
||||
totalSize: any;
|
||||
priorTableSize: number;
|
||||
createParamData(): {
|
||||
currentPageNum: number;
|
||||
dataType: any;
|
||||
submittedBatch: any;
|
||||
limit: number;
|
||||
priorTableSize: number;
|
||||
};
|
||||
getPageSizeNum(): number;
|
||||
}
|
||||
class DataModelService {
|
||||
data: any[];
|
||||
paramOptions: any;
|
||||
constructor();
|
||||
protected getDataModel(paramOptions: any): any;
|
||||
initParamOptions(): void;
|
||||
updateModel(): void;
|
||||
maybeFormat(): void;
|
||||
updateParamOption(option: string, value: any): void;
|
||||
getParamOption(key: string): any;
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
Binary file not shown.
@ -0,0 +1,101 @@
|
||||
/// <reference path="../../includes.ts"/>
|
||||
module Developer{
|
||||
var log = Logger.get('developer-navigation');
|
||||
export function createCurrentSubNavBar($scope, $location, $routeParams){
|
||||
return activateCurrent([
|
||||
{
|
||||
href: "#",
|
||||
label: "数据查看",
|
||||
title: "查看所有数据",
|
||||
items: [{
|
||||
href: UrlHelpers.join(context,"Overview/data-type/all"),
|
||||
label: "全部",
|
||||
title: "全部数据"
|
||||
},
|
||||
{
|
||||
href: UrlHelpers.join(context,"Overview/data-type/financial"),
|
||||
label: "财政",
|
||||
title: "财政数据"
|
||||
},
|
||||
{
|
||||
href: UrlHelpers.join(context,"Overview/data-type/social-security"),
|
||||
label: "社保",
|
||||
title: "社保数据"
|
||||
}]
|
||||
},
|
||||
{
|
||||
href: UrlHelpers.join(context, "task"),
|
||||
label: "任务",
|
||||
title: "数据汇总任务",
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
function activateCurrent(navBarItems) {
|
||||
navBarItems = _.compact(navBarItems);
|
||||
var injector = HawtioCore.injector;
|
||||
var $location = injector ? injector.get<ng.ILocationService>("$location") : null;
|
||||
if ($location) {
|
||||
var path = normalizeHref(trimQuery($location.path()));
|
||||
var found = false;
|
||||
function makeActive(item) {
|
||||
item.active = true;
|
||||
found = true;
|
||||
}
|
||||
function getHref(item) {
|
||||
var href = item.href;
|
||||
var trimHref = trimQuery(href);
|
||||
return normalizeHref(trimHref);
|
||||
}
|
||||
angular.forEach(navBarItems, (item) => {
|
||||
if (!found && item) {
|
||||
if (angular.isFunction(item.isActive)) {
|
||||
if (item.isActive(item, path)) {
|
||||
makeActive(item);
|
||||
}
|
||||
} else {
|
||||
var trimHref = getHref(item);
|
||||
if (!trimHref) {
|
||||
return;
|
||||
}
|
||||
if (trimHref === path) {
|
||||
makeActive(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
// Maybe it's a sub-item of a tab, let's fall back to that maybe
|
||||
if (!found) {
|
||||
angular.forEach(navBarItems, (item) => {
|
||||
if (!found) {
|
||||
if (!angular.isFunction(item.isActive)) {
|
||||
var trimHref = getHref(item);
|
||||
if (!trimHref) {
|
||||
return;
|
||||
}
|
||||
if (_.startsWith(path, trimHref)) {
|
||||
makeActive(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
// still not found, let's log it
|
||||
if (!found) {
|
||||
log.debug("No navigation tab found for path:", path);
|
||||
}
|
||||
}
|
||||
return navBarItems;
|
||||
}
|
||||
|
||||
function trimQuery(text) {
|
||||
if (text) {
|
||||
var idx = text.indexOf("?");
|
||||
if (idx >= 0) {
|
||||
return text.substring(0, idx);
|
||||
}
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,141 @@
|
||||
/// <reference path="../../includes.ts"/>
|
||||
/// <reference path="developerPlugin.ts"/>
|
||||
module Developer{
|
||||
export class OptionsParams{
|
||||
public pagerSizeOption = [20,50,100];
|
||||
public dataType =null;
|
||||
public currentTableSize =20;
|
||||
public dataBatch =null;
|
||||
public labels={};
|
||||
public currentPageNum=1;
|
||||
public totalSize=null;
|
||||
public priorTableSize = 20;
|
||||
|
||||
public createParamData(){
|
||||
var extendValue =["cityName", "districtName", "dataVersion", "systemName", "dataYear"];
|
||||
var result={
|
||||
currentPageNum: this.currentPageNum,
|
||||
dataType: this.dataType,
|
||||
submittedBatch: this.dataBatch,
|
||||
limit: this.currentTableSize,
|
||||
priorTableSize: this.priorTableSize
|
||||
}
|
||||
|
||||
angular.forEach(this.labels,(value, key) =>{
|
||||
if(extendValue.indexOf(key))
|
||||
result[key] = value;
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public getPageSizeNum(){
|
||||
var num = Math.ceil(this.totalSize/this.currentTableSize);
|
||||
if(num < this.currentPageNum)
|
||||
num = this.currentPageNum;
|
||||
return num;
|
||||
}
|
||||
}
|
||||
|
||||
function createKey(regionalismCode, systemId, version){
|
||||
return regionalismCode + "-" + systemId + "-" + version;
|
||||
}
|
||||
|
||||
function populateKey(item){
|
||||
var result = item;
|
||||
result["_key"] = createKey(item.regionalismCode, item.systemCode, item.dataVersion);
|
||||
return result;
|
||||
}
|
||||
|
||||
function populateKeys(items:Array<any>){
|
||||
var result =[];
|
||||
angular.forEach(items, (item) =>{
|
||||
result.push(populateKey(item));
|
||||
});
|
||||
}
|
||||
|
||||
function createName(cityName, districtName){
|
||||
return cityName + "-" + districtName;
|
||||
}
|
||||
|
||||
function populateName(item){
|
||||
var result = item;
|
||||
result["name"] = createName(item.cityName, item.districtName);
|
||||
return result;
|
||||
}
|
||||
|
||||
function populateNames(items:Array<any>){
|
||||
var result = [];
|
||||
angular.forEach(items, (item) =>{
|
||||
result.push(populateName(item));
|
||||
});
|
||||
}
|
||||
|
||||
function createParamData(options: OptionsParams){
|
||||
return options.createParamData();
|
||||
}
|
||||
|
||||
export class DataModelService{
|
||||
public data = [];
|
||||
public paramOptions = null;
|
||||
|
||||
constructor(){
|
||||
this.initParamOptions();
|
||||
//this.updateModel();
|
||||
this.maybeFormat();
|
||||
|
||||
}
|
||||
|
||||
//更新数据模型
|
||||
protected getDataModel(paramOptions){
|
||||
var result ;
|
||||
$.ajax({
|
||||
async: false,
|
||||
type : "POST",
|
||||
url : "/java/console/api/data.json",
|
||||
dataType : 'json',
|
||||
data: createParamData(paramOptions),
|
||||
success : function(data) {
|
||||
console.log(paramOptions);
|
||||
result = data.data;
|
||||
paramOptions.totalSize=data.length;
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
public initParamOptions(){
|
||||
this.paramOptions = new OptionsParams();
|
||||
}
|
||||
|
||||
public updateModel(){
|
||||
this.data = this.getDataModel(this.paramOptions);
|
||||
this.maybeFormat();
|
||||
}
|
||||
|
||||
//格式数据模型中的每个单条记录
|
||||
public maybeFormat(){
|
||||
populateKeys(this.data);
|
||||
populateNames(this.data);
|
||||
}
|
||||
|
||||
//更新用户选择参数
|
||||
public updateParamOption(option:string, value:any){
|
||||
this.paramOptions[option] = value;
|
||||
}
|
||||
|
||||
//根据key获取用户选择参数
|
||||
public getParamOption(key:string){
|
||||
return this.paramOptions[key];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//创建数据模型服务
|
||||
_module.factory("DataModel", ['$rootScope', '$http', '$location', '$resource', ($rootScope, $http, $location, $resource) => {
|
||||
var $scope = new DataModelService();
|
||||
return $scope;
|
||||
}]);
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
.layout-pf.layout-pf-fixed .container-pf-nav-pf-vertical {
|
||||
margin-left: 170px;
|
||||
}
|
||||
|
||||
.nav-pf-vertical {
|
||||
& .list-group > .list-group-item > a {
|
||||
width: auto;
|
||||
}
|
||||
width: auto;
|
||||
min-width: 170px;
|
||||
}
|
||||
|
||||
.nav-pf-vertical > .list-group > .list-group-item > a .fa,
|
||||
.nav-pf-vertical > .list-group > .list-group-item > a .glyphicon,
|
||||
.nav-pf-vertical > .list-group > .list-group-item > a .pficon {
|
||||
line-height: 25px;
|
||||
margin-right: 3px;
|
||||
}
|
||||
|
||||
.nav-pf-vertical > .list-group > .list-group-item > a img {
|
||||
max-height: 16px;
|
||||
max-width: 16px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.navbar-tab-vertical {
|
||||
height: 70px;
|
||||
width: 100%;
|
||||
display: block;
|
||||
background: #1d1d1d;
|
||||
border-color: #1d1d1d;
|
||||
}
|
||||
|
||||
.navbar-tab-horizontal {
|
||||
height: 100%;
|
||||
width: 100px;
|
||||
display: block;
|
||||
background: #1d1d1d;
|
||||
border-color: #1d1d1d;
|
||||
}
|
||||
|
||||
.gesture {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.navbar-lf {
|
||||
width: 200px;
|
||||
min-height: 800px;
|
||||
background: #1d1d1d;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0px;
|
||||
}
|
||||
|
||||
.navbar-lf-menu {
|
||||
display: block;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.log-img {
|
||||
width: "66";
|
||||
height: "21";
|
||||
alt: "logo";
|
||||
}
|
||||
|
||||
.fl {
|
||||
float: left;
|
||||
}
|
||||
|
||||
a.logo {
|
||||
display: block;
|
||||
width: 130px;
|
||||
padding: 20px 0 0 40px;
|
||||
}
|
||||
|
||||
.content-margin {
|
||||
margin-left: 170px;
|
||||
}
|
Loading…
Reference in new issue