123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341 |
- '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.type = sp.getUrlName("type") == "" ? 1 : sp.getUrlName("type");
- self.changeType = function (n) {
- if (self.type == n) {
- return;
- } else {
- self.type = n;
- self.search = {
- PACKAGEID: "",
- ARCHCODE: ""
- }
- self.getData(1, self.type)
- }
- }
- self.CrossPage = window.parent.CrossPage;
- 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 = {
- PACKAGEID: $.cookie("danganList3-search") && self.type == 2 ? $.cookie("danganList3-search") : "",
- ARCHCODE: $.cookie("danganList3-search") && self.type == 1 ? $.cookie("danganList3-search") : ""
- }
- self.getData = function (pageno, type) {
- self.loading = true;
- self.pageno = pageno;
- $scope.__default__currentPage = self.pageno; //设置页面样式在第几页
- self.list = [];
- var functionName = type == 1 ? "queryZLDataWithPage" : "queryDataWithPageByYJ";
- var data = type == 1 ? {
- tablename: "DOCELEMENT_ZL",
- sqlwhere: {
- MODELMARK: "1",
- DPCODE: self.userDpCode
- },
- sqlinwhere: {
- sendstatus: "6"
- },
- sqllikewhere: {
- ARCHCODE: self.search.ARCHCODE
- },
- title: "",
- order: "SORTID desc",
- pageno: self.pageno,
- pagesize: self.itemsPerPage
- } : {
- tablename: "FILETRANSFER",
- sqlwhere: {
- DPCODE: self.userDpCode
- },
- sqlinwhere: {},
- sqllikewhere: {
- PACKAGEID: self.search.PACKAGEID
- },
- order: "SORTID desc",
- pageno: self.pageno,
- pagesize: self.itemsPerPage
- }
- $http.post(apiurljs.login + "g2app/DangAn/" + functionName, { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.loading = false;
- if (res.data == null || res.data == undefined || res.data == "") {
- self.noDataTip = 0;
- } else {
- self.noDataTip = 1;
- self.list = res.data;
- console.log(self.list)
- self.listChecked = false;
- self.total_count = res.totalCount;
- if (QCHB(self.list, self["listTotal" + self.type], "ID").length > 0) {
- self["listTotal" + self.type] = self["listTotal" + self.type].concat(QCHB(self.list, self["listTotal" + self.type], "ID"))
- }
- var checkedNum = 0;
- $.each(self.list, function (index, item) {
- item.checked = false;
- item.CREATDATE = sp.format(item.CREATDATE);
- $.each(self["listTotal" + self.type], function (index1, item1) {
- if (item.ID == item1.ID) {
- item.checked = item1.checked;
- }
- })
- if (item.checked == true) {
- checkedNum++
- }
- })
- if (checkedNum == self.list.length) {
- self.listChecked = true;
- }
- }
- })
- }
- self.changeListCheck = function () {
- $.each(self.list, function (index, item) {
- item.checked = self.listChecked;
- $.each(self["listTotal" + self.type], function (index1, item1) {
- if (item1.ID == item.ID) {
- item1.checked = item.checked;
- }
- })
- })
- }
- self.changeCheck = function (item, n) {
- item.checked = n == 1 ? item.checked : !item.checked
- $.each(self["listTotal" + self.type], function (index1, item1) {
- if (item1.ID == item.ID) {
- item1.checked = item.checked;
- }
- })
- event.stopPropagation()
- }
- self.load = function () {
- if (self.get_lastReturnPageno == undefined || self.get_lastReturnPageno == null || self.get_lastReturnPageno == "") {
- self.getData(self.pageno, self.type);
- } else {
- $timeout(function () {
- self.getData(parseInt(self.get_lastReturnPageno), self.type);
- }, 1)
- }
- }
- 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.userDpName = res.data.length == 0 ? "" : res.data[0].SECTION;
- self.userDpCode = res.data.length == 0 ? "" : res.data[0].CODE;
- self.load();
- })
- }
- self.getDP();
- self.refresh = function () {
- self.CrossPage.type = null;
- self.getData(self.pageno, self.type);
- }
- ///查询-打开弹出层
- self.openSearchLayer = function () {
- sp.layer("#search");
- }
- self.btnSearch = function () {
- self.getData(1, self.type)
- if (self.type == 1) {
- $.cookie("danganList3-search", self.search.ARCHCODE, { path: '/', expires: 1 });
- } else {
- $.cookie("danganList3-search", self.search.PACKAGEID, { path: '/', expires: 1 });
- }
- sp.layerhide()
- }
- self.closeSeach = function () {
- self.search = {
- PACKAGEID: "",
- ARCHCODE: ""
- }
- sp.layerhide();
- $.cookie("danganList3-search", null, { path: '/', expires: -1 });
- self.getData(1, self.type)
- };
- self.fengzhuang = function () {
- var itemlist = [], flag = true;
- self["listTotal" + self.type].forEach(function (item) {
- if (item.checked == true) {
- itemlist.push(item.ROUTEINFOID);
- }
- })
- if (itemlist.length == 0) {
- sp.dialog("请勾选需要封装的案件!");
- return;
- }
- self.fz = {
- PACKAGEID: "",
- PACKAGETYPE: "",
- CREATOR: self.userName,
- CREATORUSERID: self.userId,
- CREATDATE: sp.format(sp.getLocalDate()),
- CREATENVIR: "",
- STORAGELOC: "",
- PACKAGEDES: "",
- ROUTEINFOIDLIST: itemlist.join(","),
- DPCODE: self.userDpCode,
- DPNAME: self.userDpName
- }
- sp.layer("#FZ")
- }
- self.btnFZ = function () {
- if (self.fz.PACKAGEID == "") {
- sp.dialog("信息包不可为空!");
- return;
- }
- var data = {
- id: 0,
- tablename: "PAGELEMENT",
- routeinfoidlist: self.fz.ROUTEINFOIDLIST,
- data: JSON.stringify(self.fz)
- }
- $http.post(apiurljs.login + "g2app/DangAn/SaveFengZhuang", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- sp.layerhide();
- if (res.code == 0) {
- sp.dialog("封装成功!");
- self.getData(self.pageno, self.type);
- self["listTotal" + self.type] = self["listTotal" + self.type].filter(function (item) {
- return self.fz.ROUTEINFOIDLIST.split(",").every(function (item1) {
- return item.ROUTEINFOID != item1;
- })
- })
- $timeout(function () {
- sp.dialoghide();
- }, 1500)
- } else {
- sp.dialog(res.message)
- }
- })
- }
- self.btnDJ = function (ID, n) {
- if (n == 1) {
- var data = {
- id: ID,
- tablename: "FILETRANSFER"
- }
- $http.post(apiurljs.login + "g2app/DangAn/queryDataById", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.dj = {
- ID: ID,
- type: 1,
- FILENAME: res.data.FILENAME,
- FILENUMBER: res.data.FILENUMBER,
- TRANSFERUNIT: res.data.TRANSFERUNIT,
- TRANSFERDATE: sp.format(res.data.TRANSFERDATE),
- ARCHIVEDATE: res.data.ARCHIVEDATE,
- ACCEPTUNIT: res.data.ACCEPTUNIT
- }
- })
- }
- if (n == 2) {
- self.dj = {
- ID: ID,
- type: 2,
- FILENAME: "",
- FILENUMBER: null,
- TRANSFERUNIT: "区委办",
- TRANSFERDATE: sp.format(sp.getLocalDate()),
- ARCHIVEDATE: "",
- ACCEPTUNIT: "档案馆"
- }
- }
- sp.layer("#DJ")
- }
- self.btnDJsubmit = function () {
- var data = {
- id: self.dj.ID,
- tablename: "FILETRANSFER",
- data: {
- FILENAME: self.dj.FILENAME,
- FILENUMBER: self.dj.FILENUMBER,
- TRANSFERUNIT: self.dj.TRANSFERUNIT,
- TRANSFERDATE: self.dj.TRANSFERDATE,
- ARCHIVEDATE: self.dj.ARCHIVEDATE,
- ACCEPTUNIT: self.dj.ACCEPTUNIT,
- REGISTATUS: "是"
- }
- }
- $http.post(apiurljs.login + "g2app/DangAn/SaveDataById", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- sp.layerhide();
- if (res.code == 0) {
- sp.dialog("登记成功!");
- $timeout(function () {
- sp.dialoghide();
- self.getData(self.pageno, self.type)
- }, 1500)
- } else {
- sp.dialog(res.message)
- }
- })
- }
- self.toHref = function (html, item, type) {
- window.location.href = html + ".html?id=" + item.ID + "&routeinfoid=" + item.ROUTEINFOID + "&lastReturn=list3&lastReturnPageno=" + self.pageno + "&type=" + type;
- event.stopPropagation()
- }
- //头部下滚冻结
- $(function () {
- //页面高度撑满
- setTimeout(function () {
- if ($(".ibox-content").height() < $(window).height() - 31) {
- $(".ibox-content").css("height", $(window).height() - 31)
- }
- }, 1)
- })
- }])
- function QCHB(arr1, arr2, filed) {
- return arr1.filter(function (item) {
- return arr2.every(function (item1) {
- return item[filed] != item1[filed];
- })
- })
- }
|