123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- 'use strict';
- var app = angular.module('app', [
- 'angularUtils.directives.dirPagination'
- ]);
- app.controller("listCtrl", ["$scope", "$http", "$timeout", "$sce", function ($scope, $http, $timeout, $sce) {
- var self = this;
- var s4 = new SM4Util();
- self.userId = $.cookie("GlWorkPlatform-userid");
- self.userName = $.cookie("GlWorkPlatform-chineseName");
- self.get_AccessToken = localStorage.getItem("GlWorkPlatform-AccessToken");
- self.dateParam = sp.getUrlName("date");
- var postCfg = {
- headers: {
- 'Content-Type': 'application/json',
- 'Authorization': "Bearer " + self.get_AccessToken
- }
- }
- self.type = 2;
- self.searchDWMC = "";
- self.searchYear = sp.currentYear() * 1;
- self.years = [sp.currentYear() * 1 - 2, sp.currentYear() * 1 - 1, sp.currentYear() * 1, sp.currentYear() * 1 + 1, sp.currentYear() * 1 + 2]
- self.getType = function () {
- var data = {
- userid: self.userId
- }
- $http.post(apiurljs.login + "g2app/dataabase/queryDPParentName", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- for (var i in res.data[0]) {
- if (res.data[0][i][0].PARENT_DATA.length > 0) {
- self.type = res.data[0][i][0].PARENT_DATA[0].SECTION != "直属单位" ? 1 : 2;
- } else {
- self.type = 1;
- }
- }
- self.getDP()
- })
- }
- self.getDP = function () {
- var data = {
- userid: self.userId
- }
- $http.post(apiurljs.login + "g2app/richang/queryDpInfo", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.userDpCode = res.data.length == 0 ? "" : res.data[0].CODE;
- self.getData();
- })
- }
- self.getData = function () {
- var sqlwhere = ["AND NF='" + self.searchYear + "'"]
- if (self.searchDWMC != "") {
- sqlwhere.push("and DWMC like '%" + self.searchDWMC + "%'")
- }
- var data = {
- pageno: 0,
- pagesize: 0,
- tztablename: "SX_CYZDXMTZ",
- tzcolums: "ID,DWMC,XMMC,WCSX",
- colums: "ID",
- order: "DWMC",
- sqlwhere: sqlwhere.join(" "),
- childtopnum: "",
- childcolumns: "ID,BH,WCQK,SJWCSJ",
- childorder: "sortid"
- }
- $http.post(apiurljs.login + "g2app/xinxifabu/queryXXFBDataWithChildAndAttach", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.list = res.data;
- })
- }
- self.getType()
- self.openLayer = function () {
- self.searchDWMC = "";
- self.searchYear = sp.currentYear() * 1;
- sp.layer("#Search")
- }
- self.doSearch = function () {
- self.getData()
- sp.layerhide()
- }
- self.initSearch = function () {
- self.searchYear = sp.currentYear() * 1;
- self.searchDWMC = "";
- self.getData()
- sp.layerhide()
- }
- self.download = function (obj) {
- window.open(apiurljs.login + "g2work/files/" + obj.FILEURL.slice(7))
- }
- }])
- app.directive("repeatFinish", function () {
- return {
- link: function (scope) {
- if (scope.$last == true) {
- setTimeout(function () {
- $("#table").rowspan(0)
- }, 10);
- }
- }
- };
- });
- jQuery.fn.rowspan = function (colIdx) { //封装的一个JQuery小插件
- return this.each(function () {
- var that;
- $('tr', this).each(function (row) {
- $('td:eq(' + colIdx + ')', this).filter(':visible').each(function (col) {
- if (that != null && $(this).html() == $(that).html()) {
- var rowspan = $(that).attr("rowSpan");
- if (rowspan == undefined) {
- $(that).attr("rowSpan", 1);
- rowspan = $(that).attr("rowSpan");
- }
- rowspan = Number(rowspan) + 1;
- $(that).attr("rowSpan", rowspan);
- $(this).hide();
- } else {
- that = this;
- }
- });
- });
- });
- }
|