123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- var app = angular.module('app', ["angularUtils.directives.dirPagination"]);
- app.controller("formlistCtrl", ["$scope", "$http", "$compile", "$timeout", function ($scope, $http, $compile, $timeout) {
- var self = this;
- var s4 = new SM4Util();
- self.userId = $.cookie("GlWorkPlatform-userid");
- self.userName = $.cookie("GlWorkPlatform-username");
- self.get_AccessToken = localStorage.getItem("GlWorkPlatform-AccessToken");
- self.get_leftActive = sp.getUrlName("leftActive");
- self.get_leftActiveType = sp.getUrlName("leftActiveType");
- $("#contentBox").height($("body").height() - 75);
- self.loading = false;
- self.btnGoBack = function () {
- ///返回上一级
- window.location.href = "formlist.html?leftActive=" + self.get_leftActive + "&leftActiveType=" + self.get_leftActiveType;
- };
- var postCfg = {
- headers: {
- 'Content-Type': 'application/json',
- 'Authorization': "Bearer " + self.get_AccessToken
- }
- };
- self.Eliminate = function () {
- self.loading = true;
- var time1 = sp.getLocalDate1();
- var data = {
- tablename: "SYS_FORM",
- sqlwhere: {
- CTYPE: "NORMAL"
- },
- sqlorwhere: {},
- sqlinwhere: {},
- sqllikewhere: {},
- colums: "*",
- order: "SORTID"
- };
- $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- self.loading = false;
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.eliminateList = res.data;
- self.EliminateAllChecked = false;
- self.eliminateList.forEach(function (item) {
- item.checked = false;
- })
- })
- }
- self.Eliminate()
- self.changeEliminate1 = function () {
- //self.EliminateAllChecked = !self.EliminateAllChecked;
- $.each(self.eliminateList, function (index, item) {
- item.checked = self.EliminateAllChecked
- })
- }
- self.changeEliminate2 = function (item) {
- item.checked = !item.checked;
- }
- self.btnEliminateTrue = function () {
- var ckeys = [];
- self.eliminateList.forEach(function (item) {
- if (item.checked == true) {
- ckeys.push(item.CKEY)
- }
- })
- if (ckeys.length == 0) {
- sp.dialog("请勾选需要清除的表单!");
- return;
- }
- 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='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 () {
- sp.dialoghide();
- var data = {
- tablename: ckeys.join(",")
- }
- $http.post(apiurljs.login + "g2app/abase/deleteTabeData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success) {
- self.Eliminate()
- } else {
- sp.dialog("删除失败,请联系管理员!")
- }
- })
- });
- }
- }])
|