123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- 'use strict';
- var app = angular.module('app', [
- ]);
- app.controller("formeditCtrl", ["$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");
- 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.Title = "稿件"
- self.SwenList = [{
- VNAME: "表单",
- TEMPFORM: "detail1.html?ID=" + self.get_id + "&type=" + self.get_type + "&lastReturnPageno=" + self.get_lastReturnPageno
- }, {
- VNAME: "附件",
- TEMPFORM: "detail2.html?ID=" + self.get_id + "&type=" + self.get_type + "&lastReturnPageno=" + self.get_lastReturnPageno
- }, {
- VNAME: "稿件",
- TEMPFORM: "#"
- }];
- 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));
- self.routeinfoid = res.data[0].ROUTEINFOID;
- var data1 = {
- tablename: "DANGANATTACHFILE",
- colums: "*",
- order: "ID",
- sqlwhere: { ROUTEINFOID: self.routeinfoid, ATTACHTYPE: "CWG_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));
- self.zhengwen = res.data;
- self.getReturnList()
- })
- })
- }
- self.getData()
- self.returnList = [];
- self.getReturnList = function () {
- var data = {
- routeinfoid: self.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;
- })
- })
- }
- self.browse = function (item) {
- var set_convertType = 0;
- if (item.FILEEXT == "doc") {
- set_convertType = 0;
- } else if (item.FILEEXT == "pdf") {
- set_convertType = 20;
- } else if (item.FILEEXT == "ofd") {
- set_convertType = 570;
- } else {
- set_convertType = 0;
- }
- let postData = {
- convertType: set_convertType,
- fileUrl: apiurljs.login.split("glwork/")[0] + "glworkweb/" + item.FILEURL
- };
- var postCfg_transfer = {
- headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
- transformRequest: function (data) {
- return $.param(data);
- }
- };
- $http.post(apiurljs.login.split("glwork/")[0] + "fcscloud/composite/httpfile", postData, postCfg_transfer)
- .success(function (res) {
- //console.log(res);
- if (res.errorcode === 0) {
- $("#iframe_WO").css("width", $(".col-md-10").width() - 10).css("height", $(window).height() - 125);
- $("#iframe_WO").attr("src", res.data.viewUrl);
- } else {
- sp.dialog(res.message);
- }
- });
- }
- //头部下滚冻结
- $(function () {
- $(".sp-page-center").css("max-height", $(window).height() - 58).css("height", $(window).height() - 58)
- //页面高度撑满
- setTimeout(function () {
- if ($(".ibox-content").height() < $(window).height() - 31) {
- $(".ibox-content").css("height", $(window).height() - 31)
- }
- }, 1)
- $(".sp-bgMask").bind("click", function () {
- $('.sp-page-center').show(); $('.Browse').attr('src', $('.Browse').attr('src'));
- });
- })
- }])
|