123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220 |
- 'use strict';
- var app = angular.module('app', ["angularUtils.directives.dirPagination"]);
- app.controller("appCtrl", ["$scope", "$http", "$compile", "$timeout", function ($scope, $http, $compile, $timeout) {
- var self = this;
- var s4 = new SM4Util();
- self.userId = $.cookie("GlWorkPlatform-userid");
- self.ushowname = $.cookie("GlWorkPlatform-username");
- self.userCName = $.cookie("GlWorkPlatform-chineseName");
- self.get_AccessToken = localStorage.getItem("GlWorkPlatform-AccessToken");
- self.userTypeEng = $.cookie("GlWorkPlatform-userTypeEng");
- var postCfg = {
- headers: {
- 'Content-Type': 'application/json',
- 'Authorization': "Bearer " + self.get_AccessToken
- }
- };
- self.loading = false;
- $(".windowHeight1").css("max-height", window.innerHeight - 60)
- $(".windowHeight2").css("max-height", window.innerHeight - 99)
- //获取传阅人员组织结构
- self.getChuanYueUser = function () {
- var data = {
- code: "AA"
- }
- $http.post(apiurljs.login + "g2app/calendar/querySect", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- $.each(res.data[0].C_H_I_L_D, function (index, item) {
- item.isChecked = false;
- item.showFlag = true;
- $.each(item.C_H_I_L_D_DATA, function (index2, item2) {
- item2.isChecked = false;
- })
- $.each(item.C_H_I_L_D, function (index3, item3) {
- item3.isChecked = false;
- item3.showFlag = true;
- $.each(item3.C_H_I_L_D_DATA, function (index4, item4) {
- item4.isChecked = false;
- })
- $.each(item3.C_H_I_L_D, function (index5, item5) {
- item5.isChecked = false;
- item5.showFlag = true;
- $.each(item5.C_H_I_L_D_DATA, function (index6, item6) {
- item6.isChecked = false;
- })
- })
- })
- })
- self.personList = res.data[0].C_H_I_L_D;
- self.getFlowData()
- })
- }
- self.getChuanYueUser()
- self.thisItem = null;
- self.itemClicked = function ($item) {
- self.thisItem = $item;
- self.getFlowData();
- };
- self.getFlowData = function () {
- self.list = [];
- self.loading = true;
- if (!self.thisItem) {
- self.loading = false;
- self.noDataTip = 0;
- return;
- }
- var data = {
- tablename: "DESK_CUSTOM",
- sqlwhere: {
- USERID: self.thisItem.userid
- },
- sqlorwhere: {},
- sqlinwhere: {},
- sqllikewhere: {},
- colums: "*",
- order: "SORTID"
- }
- $http.post(apiurljs.login + "g2app/DangJian/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.loading = false;
- if (res.success) {
- if (sp.isval(res.data)) {
- self.list = res.data;
- self.noDataTip = 1;
- } else {
- self.list = [];
- self.noDataTip = 0;
- }
- } else {
- sp.dialog(res.message);
- }
- })
- .error(function (XMLHttpRequest, textStatus, errorThrown) {
- if (textStatus != 200) {
- self.loading = false;
- }
- })
- };
- self.btnShowMark = function (item, mark) {
- 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\">确定要" + (mark == 0 ? "隐藏" : "显示") + "吗?</div>";
- var dialogFoot = "<div class=\"sp-dialog-foot\"><input id='btnDataTrue' 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.closeCenter(".sp-dialog");
- event.preventDefault(); event.stopPropagation();
- });
- //post消息的id
- $("#btnDataTrue").click(function () {
- var data = {
- id: item.ID,
- tablename: "DESK_CUSTOM",
- data: {
- SHOWMARK: mark
- }
- }
- $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));
- if (res.success) {
- self.getFlowData();
- sp.dialoghide();
- } else {
- sp.dialog(res.message);
- }
- })
- })
- }
- ////排序
- self.btnSort1 = function ($index, tip) {
- 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\">确定要" + tip + "吗?</div>";
- var dialogFoot = "<div class=\"sp-dialog-foot\"><input id='delDataTrue' 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.closeCenter(".sp-dialog");
- event.preventDefault(); event.stopPropagation();
- });
- //post消息的id
- $("#delDataTrue").click(function () {
- if (tip == "上移") {
- var data = {
- moveid: self.list[$index].ID,
- movedata: { SORTID: self.list[$index].SORTID },
- otherid: self.list[$index - 1].ID,
- otherdata: { SORTID: self.list[$index - 1].SORTID },
- tablename: "DESK_CUSTOM"
- }
- } else {
- var data = {
- moveid: self.list[$index].ID,
- movedata: { SORTID: self.list[$index].SORTID },
- otherid: self.list[$index + 1].ID,
- otherdata: { SORTID: self.list[$index + 1].SORTID },
- tablename: "DESK_CUSTOM"
- }
- }
- $http.post(apiurljs.login + "g2app/JiXiao/MoveSort", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success) {
- self.getFlowData();
- sp.dialoghide();
- } else {
- sp.dialog(res.message);
- }
- });
- });
- }
- self.btnSort2 = function (item, n) {
- 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\">确定要移至" + (n == 0 ? "首位" : "末位") + "吗?</div>";
- var dialogFoot = "<div class=\"sp-dialog-foot\"><input id='delDataTrue' 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.closeCenter(".sp-dialog");
- event.preventDefault(); event.stopPropagation();
- });
- //post消息的id
- $("#delDataTrue").click(function () {
- var data = {
- id: item.ID,
- tablename: "DESK_CUSTOM",
- movesortid: item.SORTID,
- userid: item.USERID,
- mark: n
- }
- $http.post(apiurljs.login + "g2work/deskcustom/MoveSW", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success) {
- self.getFlowData();
- sp.dialoghide();
- } else {
- sp.dialog(res.message);
- }
- });
- });
- }
- }])
|