'use strict'; var app = angular.module('app', []); 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.search = { FLOWNAME: "" } self.getData = function () { self.list = []; var data = { tablename: "DANGANFLOWMANAGE", colums: "*", order: "ID", sqlwhere:"", sqlorwhere: "", sqlinwhere: "", sqllikewhere: { FLOWNAME: self.search.FLOWNAME, } }; $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); self.list = res.data; }) } self.getData() self.Edit = function (item) { self.edit = item; sp.layer("#Edit") } self.btnSave = function () { var data = { id: self.edit.ID, tablename: "DANGANFLOWMANAGE", data: { MOBANNAME: self.edit.MOBANNAME, PRINTTYPE: self.edit.PRINTTYPE } } $http.post(apiurljs.login + "g2app/DangJian/upFormData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); sp.layerhide() if (res.success) { self.getData() sp.dialog("保存成功!"); $timeout(function () { sp.dialoghide() },1500) } else { sp.dialog(res.message) } }); } self.Del = function (item) { var dialogHead = "温馨提示×"; var dialogBody = "
您确认要删除此记录吗?
"; var dialogFoot = "
"; $('.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: "DANGANFLOWMANAGE", id: item.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)); sp.dialoghide(); if (res.success) { self.getData(self.pageno); } else { sp.dialog("删除失败,请联系管理员!"); } }); }) } ///查询-打开弹出层 self.openSearchLayer = function () { self.search = { FLOWNAME: "" } sp.layer("#search"); } self.btnSearch = function () { self.getData(1); sp.layerhide() } self.closeSeach = function () { self.search = { DOCUMENTTYPE: "", FLOWNAME: "" } sp.layerhide(); self.getData(1); }; self.init = function () { var data = { unitid: "AA", arry: ['AA01', 'AA02'] } $http.post(apiurljs.login + "g2app/DangAn/initFlowDataToDangAnManage", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); if (res.success == true) { self.getData() } else { sp.dialog(res.message) } }) } //头部下滚冻结 $(function () { //页面高度撑满 setTimeout(function () { if ($(".ibox-content").height() < $(window).height() - 31) { $(".ibox-content").css("height", $(window).height() - 31) } }, 1) }) }])