123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- 'use strict';
- var app = angular.module('app', [
- 'angularUtils.directives.dirPagination'
- ]);
- app.controller("indexCtrl", ["$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");
- self.get_type = sp.getUrlName("type");
- var postCfg = {
- headers: {
- 'Content-Type': 'application/json',
- 'Authorization': "Bearer " + self.get_AccessToken
- }
- }
- //根据选择的底稿目录获取当前目录下的文件
- self.noDataTip = 1;
- self.rows = [];
- self.pageno = 1;
- self.total_count = 0;
- self.itemsPerPage = 10;
- self.pageOptions = [10, 15, 20, 25, 30];
- self.search = {
- WZBT: ""
- }
- self.getData = function (pageno) {
- self.pageno = pageno;
- $scope.__default__currentPage = self.pageno;
- // let postData = {
- // "pageno": self.pageno,
- // "pagesize": self.itemsPerPage,
- // "code": self.nowNodeCode,
- // "data_col": "YPBH",
- // "tablename_code": "CODE_YPTYPE",
- // "tablename_data": "SX_BGYPMGR",
- // "order": "id",
- // "sqlwhere": {},
- // "sqllikewhere": {
- // "YPMC": self.search.YPMC
- // }
- // }
- let postData = {
- tablename: "SX_SCJLB",
- pagesize: self.itemsPerPage,
- pageno: self.pageno,
- colums: "*",
- order: "ID",
- sqlwhere: {
- YHID: self.userId
- },
- sqlorwhere: "",
- sqlinwhere: "",
- sqllikewhere: {
- WZBT: self.search.WZBT
- }
- }
- $http.post(apiurljs.login + "g2app/dataabase/queryDataByColWithPage", {data: s4.encryptData_CBC(JSON.stringify(postData))}, postCfg)
- .success(function (res) {
- var res = strToJson(s4.decryptData_CBC(res.data));
- console.log(res);
- if (sp.isval(res.data)) {
- res.data.forEach(function (item) {
- item.YDSJ = sp.dateFtt("yyyy-MM-dd hh:mm:ss", new Date(item.YDSJ));
- })
- self.noDataTip = 1;
- self.rows = res.data;
- self.total_count = res.totalCount;
- } else {
- self.rows = [];
- self.noDataTip = 0;
- }
- }).error(function (err) {
- sp.dialog(JSON.stringify(err));
- });
- }
- self.getData(1);
- //弹出筛选框
- self.openSearchLayer = function () {
- sp.layer("#layer_search");
- }
- self.doSearch = function () {
- sp.closeCenter('.sp-layer');
- self.pageno = 1; // 初始化 当前页为 1
- self.getData(self.pageno);
- }
- self.deleteData = function ($item) {
- var getDelID = $item.ID;
- 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 data-id=" + getDelID + " 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 getid = $(this).attr("data-id");
- sp.dialoghide();
- var data = {"id": $item.ID, "tablename": "SX_SCJLB"}
- //console.log(data);
- $http.post(apiurljs.login + "g2app/richang/delDataById", {data: s4.encryptData_CBC(JSON.stringify(data))}, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success) {
- self.getData(1);
- } else {
- sp.dialog(res.message);
- }
- })
- .error(function (XMLHttpRequest, textStatus, errorThrown) {
- })
- });
- }
- self.itemCheck = function (item) {
- console.log(item);
- if (item.WZMK == "文件发布") {
- let url='tpl/wenjianbg/WJFBB/detail.html?id=' + item.WZID + '&formPage=wenjianshow&tablename=WJFB_CB&code=LX&val=' + item.WZZMK;
- parent.sp.addTabNav('FZE02', '发布一览', url);
- } else if (item.WZMK == "图片新闻") {
- let url = 'tpl/wenjianbg/WJFBB1/detail.html?id=' + item.WZID + '&formPage=wenjianshow'
- parent.sp.addTabNav('FZE02', '发布一览', url);
- } else if (item.WZMK == "通知公告") {
- let url = 'tpl/tongzhibg/TZGG/detail.html?id=' + item.WZID + '&formPage=wenjianshow&tablename=SX_TZGG&code=GGBK&val=' + item.WZZMK;
- parent.sp.addTabNav('FZE02', '发布一览', url);
- }
- }
- }])
|