123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 |
- 'use strict';
- var app = angular.module('app', [
- 'angularUtils.directives.dirPagination'
- ]);
- app.controller("listCtrl", ["$scope", "$http", "$timeout", function ($scope, $http, $timeout) {
- 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.get_lastReturnPageno = sp.getUrlName("lastReturnPageno");
- var postCfg = {
- headers: {
- 'Content-Type': 'application/json',
- 'Authorization': "Bearer " + self.get_AccessToken
- }
- }
- self.loading = false;
- self.noDataTip = 1;//没有数据时赋变量为0,先默认为1
- self.listTotal1 = [];
- self.listTotal2 = [];
- self.list = [];
- self.pageno = 1;
- self.total_count = 0;
- self.itemsPerPage = 10;
- self.pageOptions = [10, 20, 30, 40];
- self.search = JSON.parse($.cookie("ygdlist-search"));
- //1为已提交、2为退回、3为合并提交、4为合并草稿、5为封装、6为已整理提交
- self.getData = function (pageno, type) {
- if (self.search == null) {
- self.search = {
- title: "",
- dah: ""
- }
- }
- $.cookie("ygdlist-search", JSON.stringify(self.search), { path: '/', expires: 1 });
- self.loading = true;
- self.pageno = pageno;
- $scope.__default__currentPage = self.pageno; //设置页面样式在第几页
- self.list = [];
- var data = {
- tablename: "DA_YGD",
- pagesize: self.itemsPerPage,
- pageno: self.pageno,
- colums: "ID,ROUTEINFOID,TITLE_PROPER,OFFICE_ARCHIVAL_CODE,RETENTION_PERIOD,TO_CHAR(DATE_OF_CREATION,'yyyy-mm-dd')as DATE_OF_CREATION",
- order: "ID",
- sqlwhere: "",
- sqlorwhere: "",
- sqlinwhere: "",
- sqllikewhere: {
- TITLE_PROPER: self.search.title,
- OFFICE_ARCHIVAL_CODE: self.search.dah
- }
- };
- $http.post(apiurljs.login + "g2app/dataabase/queryDataByColWithPage", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.loading = false;
- if (res.totalCount == 0) {
- self.noDataTip = 0;
- } else if (res.data == null || res.data == undefined || res.data == "") {
- self.noDataTip = 0;
- self.getData(self.pageno - 1)
- } else {
- self.noDataTip = 1;
- self.list = res.data;
- self.list.forEach(function (item) {
- item.RETENTION_PERIOD1 = item.RETENTION_PERIOD == "D10" ? "10年" : item.RETENTION_PERIOD == "D30" ? "30年" : item.RETENTION_PERIOD == "Y" ? "永久" : item.RETENTION_PERIOD
- })
- }
- })
- }
- self.load = function () {
- if (self.get_lastReturnPageno == undefined || self.get_lastReturnPageno == null || self.get_lastReturnPageno == "") {
- self.getData(self.pageno);
- } else {
- $timeout(function () {
- self.getData(parseInt(self.get_lastReturnPageno));
- }, 1)
- }
- }
- self.load();
- self.refresh = function () {
- self.CrossPage.type = null;
- self.getData(self.pageno);
- }
- ///查询-打开弹出层
- self.openSearchLayer = function () {
- if (self.search == null) {
- self.search = {
- title: "",
- dah: ""
- }
- }
- sp.layer("#search");
- }
- self.btnSearch = function () {
- self.getData(1);
- sp.layerhide()
- }
- self.closeSeach = function () {
- self.search = {
- title: "",
- dah: ""
- }
- sp.layerhide();
- $.cookie("ygdlist-search", null, { path: '/', expires: -1 });
- self.getData(1);
- };
- self.Edit = function (item) {
- window.location.href = "yuguidang.html?ID=" + item.ID + "&routeinfoid=" + item.ROUTEINFOID + "&lastReturn=list&lastReturnPageno=" + self.pageno
- event.stopPropagation()
- }
- self.Delete = function (id) {
- var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
- var dialogBody = "<div class=\"sp-dialog-body\">您确认要删除此记录吗?</div>";
- var dialogFoot = "<div class=\"sp-dialog-foot\"><input id='upDataTrue' type='button' value='确 认' class='sp-dialog-btnTrue' /><input type='button' value='取 消' class='sp-dialog-btnCancle sp-closeDialog' /></div>";
- $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
- sp.openCenter(".sp-dialog");
- $('.sp-closeDialog').click(function (event) {
- sp.dialoghide();
- event.preventDefault();
- event.stopPropagation();
- });
- $("#upDataTrue").click(function () {
- sp.dialoghide();
- var data = {
- tablename: "DA_YGD",
- id: id
- };
- $http.post(apiurljs.login + "g2app/dataabase/delDataById", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success) {
- self.getData(self.pageno);
- }
- })
- })
- }
- //头部下滚冻结
- $(function () {
- //页面高度撑满
- setTimeout(function () {
- if ($(".ibox-content").height() < $(window).height() - 31) {
- $(".ibox-content").css("height", $(window).height() - 31)
- }
- }, 1)
- })
- }])
|