'use strict'; var app = angular.module('app', [ ]); app.controller("formeditCtrl", ["$scope", "$http", "$timeout", '$sce', function ($scope, $http, $timeout, $sce) { 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"); self.get_id = sp.getUrlName("ID"); self.return = "list1.html?lastReturnPageno=" + self.get_lastReturnPageno + "&type=" + self.get_type var postCfg = { headers: { 'Content-Type': 'application/json', 'Authorization': "Bearer " + self.get_AccessToken } }; self.FormTitle = $.cookie("GlWorkPlatform-SYSNAME"); self.Title = "表单" self.SwenList = [{ VNAME: "表单", TEMPFORM: "#" }, { VNAME: "附件", TEMPFORM: "detail2.html?ID=" + self.get_id + "&type=" + self.get_type + "&lastReturnPageno=" + self.get_lastReturnPageno }, { VNAME: "稿件", TEMPFORM: "detail3.html?ID=" + self.get_id + "&type=" + self.get_type + "&lastReturnPageno=" + self.get_lastReturnPageno }]; self.getData = function () { var data = { tablename: "DOCELEMENT", colums: "*", order: "ID", sqlwhere: { ID: self.get_id }, sqlorwhere: "", sqlinwhere: "", sqllikewhere: "" }; $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)); var data1 = { tablename: "DANGANATTACHFILE", colums: "*", order: "ID", sqlwhere: { ROUTEINFOID: res.data[0].ROUTEINFOID, ATTACHTYPE: "FORM_PDF" }, sqlorwhere: "", sqlinwhere: "", sqllikewhere: "" } $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data1)) }, postCfg) .success(function (obj1) { var res1 = strToJson(s4.decryptData_CBC(obj1.data)); console.log(res1) self.bd = false; res1.data.forEach(function (item) { console.log(item) if (item.FILEEXT == "pdf") { self.bd = true; $.ajax({ url: apiurljs.login.split("glwork")[0] + "fcscloud/composite/httpfile", type: "post", dataType: 'json', contentType: "application/x-www-form-urlencoded", data: { convertType: 20, fileUrl: apiurljs.login + "g2work/files2/inline/" + item.FILEURL.slice(7) }, success: function (res) { if (res.errorcode === 0) { let rst = res.data; $("#iframe").css("width", $(".ibox-content").width()).css("height", $(window).height() - 113); $("#iframe").attr("src", rst.viewUrl) } else { console.log(res.message); } } }) } }) }) self.getReturnList(res.data[0].ROUTEINFOID) }) } self.getData() self.returnList = []; self.getReturnList = function (routeinfoid) { var data = { routeinfoid: routeinfoid, tablename: "DOCELEMENT_01" } $http.post(apiurljs.login + "g2app/DangAn/GetDataListForPid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); self.returnList = res.data; self.returnListShow = false; self.selectReturn = self.returnList[0]; $.each(self.returnList, function (index, item) { item.BACKDATE1 = sp.format(item.BACKDATE); item.BACKDATE = sp.formatMinute(item.BACKDATE); item.BACKOPINION1 = item.BACKOPINION.length > 12 ? item.BACKOPINION.slice(0, 12) + "..." : item.BACKOPINION; }) }) } //头部下滚冻结 $(function () { $(".sp-page-center").eq(0).css("max-height", $(window).height() - 160).css("height", $(window).height() - 160) //页面高度撑满 setTimeout(function () { if ($(".ibox-content").height() < $(window).height() - 31) { $(".ibox-content").css("height", $(window).height() - 31) } }, 1) }) }])