lxy-kit/tpl/front/ext/CtrlExtTpl.js
2019-03-13 16:03:59 +08:00

115 lines
4.4 KiB
JavaScript

define(["app", "constant", "config","yCommon", "bootbox","common_tools", "dir_datepicker", "dir_paging", "yService", "dir_table_column_config", "tools_factory","dir_select","dir_file_upload",'dir_echart2'],
function(app, constant, config, yCommon, bootbox, commonTools) {
app.register.controller('aqsjListCtrl', ["$scope", "rootMap", "$state", "yService", "toolsFactory","$stateParams","$sce",
function($scope, rootMap, $state, yService, toolsFactory,$stateParams,$sce) {
$scope.cfgAll = {
#for(x : data)
#(x.beanFL):{
title:"#(x.remark)"
,url:"/#(x.beanL)"
,field_label: [#(x.label)]
,field:[#(x.field)]
},
#end
};
var pk = "#(data[0].beanFL)";
$scope.cfg = $scope.cfgAll[pk];
var cfg = $scope.cfg;
//页面加载
function pageInit() {
$("#"+ pk).addClass('t-active');
initTab();
$scope.query();
}
function initTab(){
$scope.cfg = $scope.cfgAll[pk];
cfg = $scope.cfg;
$scope.type= pk;
yService.initService(cfg["url"]);
yCommon.initScope($scope, $sce,rootMap,{},yService);
$scope[pk] = $scope[pk] || {};
$scope.queryCondition = yCommon.getConditon($state);
//初始化分页数据值
$scope["pageOptions"] = {
server: config.services.assetmag,
url: cfg.url,
id: "xxPaging"
};
//查询功能实现
$scope.query = function() { //点击查询 更新查询条件缓存
$scope.pageOptions = $scope.pageOptions || {};
$scope.pageOptions.param = angular.copy($scope[pk].queryCondition);
$scope.pageOptions.reload = true;
yCommon.setCondition($scope.queryCondition);//预存查询条件
toolsFactory.closeDialog();
};
//重置按钮
$scope.reset = function() {
var queryCondition = $scope.queryCondition;
commonTools.resetQueryParmeter(queryCondition);
yCommon.setCondition({});//预存查询条件
};
//分页插件查询回调
$scope.operatePaging = function(total, rows) {
$scope.rows = rows;
$scope.total = total;
};
$scope[pk]["queryCondition"] = $scope[pk]["queryCondition"] || {};
}
$('#ul1 li').click(function() {
$('#ul1 li').removeClass('t-active');
$(this).addClass('t-active');
$scope.type = $(this).attr("id");
if(pk == $(this).attr("id")) return false;
pk = $(this).attr("id");
initTab();
$scope.query();
$scope.$apply();
});
//条件查询弹出层
$scope.condition = function(){
toolsFactory.openDialog($scope, app.tplsBasePath + 'threatmag/'+ pk +'/condition.html');
}
//回车键查询
$scope.keySearch = function(e){
var keycode = window.event ? e.keyCode : e.which;
if(keycode == 13){
$scope.query();
}
};
$scope.add = function(){
$scope.title = cfg.title +"添加";
$state.$go('threatmag.'+ pk +'.edit',{});
}
$scope.detail = function(row){
$state.$go('threatmag.'+ pk +'.detail',{row:row});
}
$scope.update = function(row){
$scope.title = cfg.title + "修改";
$state.$go('threatmag.'+ pk +'.edit',{row:row});
}
pageInit();
}
]);
})