123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- '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 = "<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: "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)
- })
- }])
|