123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397 |
- 'use strict';
- var app = angular.module('app', [
- 'angularUtils.directives.dirPagination'
- ]);
- 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_id = sp.getUrlName("id")
- self.routeinfoid = sp.getUrlName("routeinfoid");
- self.type = sp.getUrlName("type");
- self.get_lastReturn = sp.getUrlName("lastReturn");
- self.get_lastReturnPageno = sp.getUrlName("lastReturnPageno");
- self.return = self.get_lastReturn + ".html?lastReturnPageno=" + self.get_lastReturnPageno + "&type=" + self.type
-
- var postCfg = {
- headers: {
- 'Content-Type': 'application/json',
- 'Authorization': "Bearer " + self.get_AccessToken
- }
- };
- self.SwenList = [{
- VNAME: "文件详情",
- TYPE: 1,
- PAGE: "list2",
- TEMPFORM: "formedt.html?id=" + self.get_id + "&routeinfoid=" + self.routeinfoid + "&lastReturn=" + self.get_lastReturn + "&lastReturnPageno=" + self.get_lastReturnPageno + "&type=" + self.type
- }, {
- VNAME: "文件详情",
- TYPE: 1,
- PAGE: "list3",
- TEMPFORM: "submitdetail.html?id=" + self.get_id + "&routeinfoid=" + self.routeinfoid + "&lastReturn=" + self.get_lastReturn + "&lastReturnPageno=" + self.get_lastReturnPageno + "&type=" + self.type
- }, {
- VNAME: "文件详情",
- TYPE: 2,
- TEMPFORM: "submitdetail.html?id=" + self.get_id + "&routeinfoid=" + self.routeinfoid + "&lastReturn=" + self.get_lastReturn + "&lastReturnPageno=" + self.get_lastReturnPageno + "&type=" + self.type
- }, {
- VNAME: "附件列表",
- TYPE: self.type,
- TEMPFORM: "attachlist.html?id=" + self.get_id + "&routeinfoid=" + self.routeinfoid + "&lastReturn=" + self.get_lastReturn + "&lastReturnPageno=" + self.get_lastReturnPageno + "&type=" + self.type
- }]
- self.Title = "附件列表"
- self.iframeFlag = false;
- self.zhengwen = []
- self.fujian = [];
- self.wendan = [];
- self.liuzhuan = [];
- self.getSelect = function () {
- self.select = { list: [] }
- var data = {
- tablename: "SYS_SECT",
- colums: "*",
- order: "SORTID",
- sqlwhere: "",
- 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.select.list = res.data;
- self.getData();
- })
- }
- self.getSelect()
- self.getData = function () {
- var data = {
- tablename: "DOCELEMENT_ZL",
- colums: "*",
- order: "ID",
- sqlwhere: { ROUTEINFOID: self.routeinfoid },
- 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.data = res.data[0];
- self.select.list.forEach(function (item) {
- if (self.data.ORGANIZATIONMA == item.CODE) {
- self.data.ORGANIZATIONMA1 = item.SECTION;
- }
- })
- self.getZhengWen();
- })
- }
- self.getZhengWen = function () {
- var ATTACHTYPE;
- if ((self.type == 2 || self.get_lastReturn == "list3") && self.data.TABLENAME.indexOf("FW_") > -1) {
- ATTACHTYPE = "GDZ_PDF"
- } else {
- ATTACHTYPE = "CWG_PDF"
- }
- var data = {
- tablename: "DANGANATTACHFILE",
- colums: "*",
- order: "ID",
- sqlwhere: { ROUTEINFOID: self.routeinfoid, ATTACHTYPE: ATTACHTYPE },
- 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.zhengwen = res.data;
- $.each(self.zhengwen, function (index, item) {
- item.url = item.FILEURL
- item.FILEURL = apiurljs.login.split("glwork")[0] + "glworkweb/" + item.FILEURL
- })
- if (self.zhengwen.length > 0) {
- self.browse1(self.zhengwen[0]);
- self.iframeFlag = true;
- }
- self.getWenDan()
- })
- //var data = {
- // dockind: "D02",
- // routeinfoid: self.routeinfoid
- //}
- //$http.post(apiurljs.login + "g2app/fawenfiles/queryDataList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- //.success(function (obj) {
- // var res = strToJson(s4.decryptData_CBC(obj.data));
- // self.zhengwen = res.data;
- // $.each(self.zhengwen, function (index, item) {
- // item.url = item.FILEURL
- // item.FILEURL = apiurljs.login.split("glwork")[0] + "glworkweb/" + item.FILEURL
- // })
- // if (self.zhengwen.length > 0) {
- // if (self.type == 1 && self.get_lastReturn == "list2") {
- // self.browse1(self.zhengwen[0]);
- // } else {
- // self.browse2(self.zhengwen[0]);
- // }
- // self.iframeFlag = true;
- // }
- // self.getWenDan()
- //})
- };
- self.getWenDan = function () {
- var ATTACHTYPE;
- if ((self.type == 2 || self.get_lastReturn == "list3") && self.data.TABLENAME.indexOf("SW_") > -1) {
- ATTACHTYPE = "GDZ_PDF"
- } else {
- ATTACHTYPE = "FORM_PDF"
- }
- var data1 = {
- tablename: "DANGANATTACHFILE",
- colums: "*",
- order: "ID",
- sqlwhere: { ROUTEINFOID: self.routeinfoid, ATTACHTYPE: ATTACHTYPE },
- sqlorwhere: "",
- sqlinwhere: "",
- sqllikewhere: ""
- }
- $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data1)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- console.log(res)
- $.each(res.data, function (index, item) {
- if (item.FILEEXT == "pdf") {
- item.url = item.FILEURL
- item.FILEURL = apiurljs.login + "g2work/files2/inline/" + item.FILEURL.slice(7)
- //item.FILEURL = apiurljs.login + "g2work/files2/inline/" + res.data[0].FILEURL.slice(7)
- self.wendan.push(item)
- }
- })
- //self.wendan.push(res.data[0])
- if (self.zhengwen.length == 0 && self.wendan.length > 0) {
- self.browse1(self.wendan[0]);
- self.iframeFlag = true;
- }
- self.getFuJian();
- })
- }
- self.getFuJian = function () {
- var data = {
- routeinfoid: self.routeinfoid,
- sqlwhere: " and fileext='pdf'",
- attachtype: ['FORM_PDF', 'CWG_PDF', 'GDZ_PDF', 'FLOWRECORD_PDF']//['FORM_PDF', 'CWG_PDF', 'GDZ_PDF', 'ZLFILE_PDF']
- }
- $http.post(apiurljs.login + "g2app/DangAn/getAttachListNotAttachType", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.fujian = res.data;
- $.each(self.fujian, function (index, item) {
- item.SIZE = item.FILESIZE >= 104857.6 ? (item.FILESIZE / 1048576).toFixed(2) + "MB" : (item.FILESIZE / 1024).toFixed(2) + "KB";
- item.FILEURL = apiurljs.login + "g2work/files2/inline/" + item.FILEURL.slice(7)
- })
- if (self.zhengwen.length == 0 && self.wendan.length == 0 && self.fujian.length > 0) {
- self.browse1(self.fujian[0]);
- self.iframeFlag = true;
- }
- self.getRecord()
- })
- }
- self.getRecord = function () {
- var data = {
- tablename: "DANGANATTACHFILE",
- colums: "*",
- order: "ID",
- sqlwhere: { ROUTEINFOID: self.routeinfoid, ATTACHTYPE: "FLOWRECORD_PDF" },
- 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.liuzhuan = res.data;
- $.each(self.liuzhuan, function (index, item) {
- item.url = item.FILEURL
- if (item.FILEEXT == "pdf") {
- item.FILEURL = apiurljs.login + "g2work/files2/inline/" + item.FILEURL.slice(7)
- } else {
- item.FILEURL = apiurljs.login.split("glwork")[0] + "glworkweb/" + item.FILEURL
- }
- })
- console.log(self.liuzhuan)
- if (self.zhengwen.length == 0 && self.wendan.length == 0 && self.fujian.length == 0 && self.liuzhuan.length > 0) {
- self.browse1(self.liuzhuan[0]);
- self.iframeFlag = true;
- }
- })
- }
- self.btnDelete = function (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 id='upDataTrue' 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.dialoghide();
- event.preventDefault(); event.stopPropagation();
- });
- $("#upDataTrue").click(function () {
- var data = {
- id:ID
- }
- $http.post(apiurljs.login + "g2app/DangAn/deleteAttach", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success) {
- sp.dialoghide();
- self.getFuJian();
- }
- })
- })
- }
-
- self.browse1 = function (obj) {
- ///20230324---zyg ---永中转换-----start
- var set_convertType = 0;
- if (obj.FILEEXT == "doc") {
- set_convertType = 0;
- } else if (obj.FILEEXT == "pdf") {
- set_convertType = 20;
- } else if (obj.FILEEXT == "ofd") {
- set_convertType = 570;
- } else {
- set_convertType = 0;
- }
- let postData = {
- convertType: set_convertType,
- fileUrl: obj.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) {
- if (res.errorcode === 0) {
- let rst = res.data;
- $("#iframe").css("width", $(".col-md-10").width() - 10).css("height", 654);
- $("#iframe").attr("src", rst.viewUrl)
- } else {
- sp.dialog(res.message);
- }
- });
- ///20230324---zyg ---永中转换-----end
- }
- self.btnGui = function () {
- if (self.data.ARCHCODE == "" || self.data.ARCHCODE == null || self.data.ARCHCODE == undefined) {
- sp.dialog("请先生成档号!");
- return
- }
- var array = ["全宗号", "年度", "件号", "X154", self.data.ARCHYEAR, self.data.JIANHAO, "机构(问题)", "保管期限", "页数", self.data.ORGANIZATIONMA1, self.data.MIJIQIXIAN, self.data.YESHU]
- if (self.data.TABLENAME.indexOf("SW") > -1) {
- var data = {
- data: array,
- sourcepath: self.wendan[0].url.slice(6),
- routeinfoid: self.routeinfoid,
- marginLeft: 430,
- marginBottom: 749
- }
- $http.post(apiurljs.login + "g2app/DangAn/PdfInPng", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- //$("#GuiDangZ").attr("src", apiurljs.login + "g2work/files2/inline/" + res.data.slice(6))
- var dataStatus = {
- tablename: "DOCELEMENT_ZL",
- id: self.get_id,
- data: {
- SENDSTATUS: 3,
- MODELMARK: 1
- }
- }
- $http.post(apiurljs.login + "g2app/dataabase/upFormData", { data: s4.encryptData_CBC(JSON.stringify(dataStatus)) }, postCfg)
- .success(function (obj1) {
- let postData = {
- convertType: 20,
- fileUrl: apiurljs.login + "g2work/files2/inline/" + res.data.slice(6)
- };
- 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) {
- if (res.errorcode === 0) {
- let rst = res.data;
- //$("#GuiDangZ").attr("src", apiurljs.login + "g2work/files2/inline/" + res.data.slice(6))
- $("#GuiDangZ").attr("src", rst.viewUrl)
- } else {
- sp.dialog(res.message);
- }
- });
- })
- })
- } else {
- var data = {
- data: array,
- sourcepath: self.zhengwen[0].url,
- routeinfoid: self.routeinfoid,
- marginLeft: 430,
- marginBottom: 749
- }
- $http.post(apiurljs.login + "g2app/DangAn/PdfInPng", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- var dataStatus = {
- tablename: "DOCELEMENT_ZL",
- id: self.get_id,
- data: {
- SENDSTATUS: 3
- }
- }
- $http.post(apiurljs.login + "g2app/dataabase/upFormData", { data: s4.encryptData_CBC(JSON.stringify(dataStatus)) }, postCfg)
- .success(function (obj1) {
- //$("#GuiDangZ").attr("src", apiurljs.login + "g2work/files2/inline//" + res.data.slice(7))
- let postData = {
- convertType: 20,
- fileUrl: apiurljs.login + "g2work/files2/inline/" + res.data.slice(7)
- };
- 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) {
- if (res.errorcode === 0) {
- let rst = res.data;
- $("#GuiDangZ").attr("src", apiurljs.login + "g2work/files2/inline/" + res.data.slice(7))
- } else {
- sp.dialog(res.message);
- }
- });
- })
- })
- }
- sp.layer("#GDZ")
- }
- }])
|